mc-Things

mc-Innovation Showcase => mc-Innovations => Topic started by: kristofferis on December 31, 2016, 05:12:42 am

Title: mcModule goes IKEA Ansluta
Post by: kristofferis 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

Title: Re: mcModule goes IKEA Ansluta
Post by: mc-T2 on January 03, 2017, 09:29:05 am
Very cool! Thanks for sharing!!
Title: Re: mcModule goes IKEA Ansluta
Post by: kbrooking 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.
Title: Re: mcModule goes IKEA Ansluta
Post by: kristofferis 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.