Author Topic: mcModule goes IKEA Ansluta  (Read 156 times)

kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
mcModule goes IKEA Ansluta
« on: December 31, 2016, 05:12:42 am »
Hello.
I am done renovating my kitchen and after some time spending looking at different light solutions it ended up with IKEA Ansluta LED Light.
The light is operated wireless from a IKEA ansluta remote control, and that is not as smart as the rest of my house so I had to automate this lights as well.

I made a very simple solution, i opened the wireless controller and replaced the manual switch with a transistor that i control from a mcModule and MQTT, i have also added a manual switch just in case you want to change it from the automated light schedule.

The mcModule is not battery powered so no need to worry about any battery (Lplan.SetMidPowerMode(100))

I am running this in the kitchen right now but still just on a mcDevboard, i will have to create a better installation but I just wanted to make sure that it works as it should.

A very simple code for a very simple solution  :)

Code: [Select]
Define PinMode Pin0 As DigitalOutput Alias Send = False
Define PinMode Pin1 As DigitalInputPullUp Alias Button

Class IKEA_Ansluta
   
    Shared Event Boot()
        Lplan.SetMidPowerMode(100)
        Lplan.Subscribe("mcModule/000111E0/kitchen/ikeaansluta/cmd")
    End Event
   
    Shared Event SubscriptionDelivery()
        Dim msg As Message = Lplan.GetDelivery()
        Dim payload As ListOfByte = msg.PayLoad
       
        If payload(0).ToString() = "49" Then
            sendCMD()
        ElseIf payload(0).ToString() = "50" Then
            sendCMD()
            Thread.Sleep(500000)
            sendCMD()
        ElseIf payload(0).ToString() = "51" Then
            sendCMD()
            Thread.Sleep(500000)
            sendCMD()
            Thread.Sleep(500000)
            sendCMD()
        ElseIf payload(0).ToString() = "52" Then
            sendRegister()
        End If
       
    End Event
   
    Shared Event Pin1FallingEdge()
        sendCMD()
    End Event
   
    Public Function sendCMD() As Boolean
        Send = True
        Send = False
    End Function
    Public Function sendRegister() As Boolean
        Send = True
        Thread.Sleep(5000000)
        Send = False
    End Function
End Class

« Last Edit: January 18, 2017, 09:04:07 am by mc-T2 »

Share on Facebook Share on Twitter Share on Google+

Like Like x 1 View List

mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: mcModule goes IKEA Ansluta
« Reply #1 on: January 03, 2017, 09:29:05 am »
Very cool! Thanks for sharing!!
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: mcModule goes IKEA Ansluta
« Reply #2 on: January 05, 2017, 09:31:49 am »
Nice project!  Iím wondering if something similar could be used to remotely control a web cam using MQTT. Say like taking a photo or something.

kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: mcModule goes IKEA Ansluta
« Reply #3 on: January 05, 2017, 11:54:57 am »
No you have any special web cam in mind?
If it does have any kind of remote interface then I think it's a good chance to create that.