Domoticz

Ideas anyone? Installed Domoticz just to see how well it might work… needs an add-on for MQTT here https://github.com/sschimmel/DomoticzMQTT  – grabbed that, put the files in nodejs\node_modules\domo and ran node server.js as per the recommendation.. and.. it threw an error “Cannot find module “mqtt”

Update September 2015: MQTT is now part of the Raspberry Pi image for Domitz – just note that you need to add MQTT as hardware by going to setup/hardware. Tested with MQTT spy.  You can grab a complete Raspberry Pi image – or do what I did which was to add it to the existing image. The instructions are here.

https://www.domoticz.com/wiki/Installing_and_running_Domoticz_on_a_Raspberry_PI

6 lines of setup including clean-up can’t be bad!

However when we tried to install Domoticz from the instructions on an existing system, everything worked but I put in the wrong port for MQTT. I then went to bed and the next morning the installation had crashed – hardly a good start for getting my confidence up.

To cut a long story short, a complete re-install seemed the best idea and this time everything worked. 

Things I control – lights – lots of them – and RGB lights –lots of those too.  Once you have everything setup you can simply add new lights and when you turn them on or off, an MQTT message is generated…. with a light ID and it’s status. And so it is with RGB… but for one issue  -there is no RGB status  – which begs the question – how on earth do you use Domoticz to control an RGB virtual light – via Node-Red. It would APPEAR that you cannot. I’ve looked at their forums – people are asking the same question and coming to the same conclusion.

And with that I’ll put this to one side until someone tells me I’ve missed the point – but I can assure you that the MQTT package coming out of Domoticz when you change the colour of a virtual RGB light – does NOT include the colour!

16 thoughts on “Domoticz

  1. If it helps I was playing with OpenHAB tonight and here are the steps to connect OpenHAB to Mosquitto, and communicate 2 way to an ESP via MQTT

    Using a default Windows OpenHAB install with the demo app installed
    Add these lines to C:\openhab\configurations\openhab.cfg
    (change the IP/Port to match your config – this uses a non SSL connection)
    mqtt:broker.url=tcp://192.168.0.32:1883
    mqtt:broker.clientId=openhab
    mqtt-eventbus:broker=broker
    mqtt-eventbus:commandPublishTopic=home/openHAB/out/${item}/command
    mqtt-eventbus:statePublishTopic=home/openHAB/state/${item}/state
    mqtt-eventbus:stateSubscribeTopic=/openHAB/in/${item}/state

    Now to change a component in the demo site first get the component name from the item file C:\openhab\configurations\items\demo.items
    So you can see the FF bathroom light is named Switch Light_FF_Bath_Ceiling

    To change the state of the FF bathroom light via MQTT
    Send ON or OFF to
    /openHAB/in/Light_FF_Bath_Ceiling/state

    To detect a state change initiated from the website
    Subscribe to
    home/openHAB/out/Light_FF_Bath_Ceiling/command
    For a switch you will see ON or OFF as data

    So just have your ESP subscribe to the ‘out’ and send to the ‘state’ it should allow basic control and feedback. It would be better if the website didn’t change the state until it received a confirmation from the device via the state message but it’s probably possible somehow.

      1. Well, YES is the answer you CAN separate off the state.. I find it really dumb that when you turn the light switch on, the lamp comes on even if the unit at the other end is not talking – reminds me of X10. I can’t remember how I did it now but I plan to start from scratch with OpenHab. You can have it NOT do anything to the light – then have a status message come back and turn the little yellow light on or off depending on the state. What’s needed is not the demo but a blank openhab with MQTT all set up and some simple examples of adding devices… If you get that far please do share.

    1. It is possible – I did it but didn’t mark it down. I’ve been too busy with other stuff – including now trying to get the new Raspberry Pi working. I have PHP running so I can send MQTT messages – but I can’t get CRON to deliver the pages.. but it’s not cron – it’s running PHP off the command line. I’m hoping someone can help. Se elsewhere.

      1. I believe I solved it somewhat – you can mark an item as autoupdate=false which will prevent the light from changing state until the ESP informs openhab it has made the change via mqtt (the switch still switches though even without the confirmation)
        Details on my blog (part 2) if anyone is interested.

        I’m still not happy with this though since if your ESP dies there is no way to mark the item in an unknown/error state in OpenHAB (not that I can find at least). It remains in the last state reported. I would prefer the mqtt lwt trigger OpenHAB to mark the item in an error state (or at least unknown).
        I have a thread going on the OpenHAB support site to see if I am just missing something.

  2. Thank you for providing this blog. While waiting for my ESP8266 to arrive it introduced me to node.js, node-red and mqtt. I was already using domoticz so I also tried to get mqtt working. I had the same error! Appears the path to the modules is wrong. I solved it by installing the needed module locally with npm install mqtt. I guess in your case you just have to update the request paths in domoticsz.is by adding ../ to them.

  3. So which one is better Domoticz or OpenHab?. Let us know if you know both. I am just starting on home automation and need something working soon. I can review both at later stage but want to start with something that I can initially spend some time on with good results. Comparison blog might be in order here 🙂

    1. I don’t. I’ve read a little of both and understand neither at this point. I’ve spent all this time getting to the bottom of the ESP issues – now I want to spend some time on these packages.

      1. I am newbee in the home automation area. I am also confused in the selection of the automation software. Since the post is quite old. I assume you will have fair idea about Domoticz & OpenHAB.
        I have started using OpenHAB. Seems good to me, however I think the graphics can be definitely updated. No idea about Domoticz as of now.
        Kindly suggest me which one is better.

        1. Hi

          Personally I would not use either – but that’s just me. I found Openhab to be way to complicated for beginners to set up – hence I went down the road of developing my own rules using Node-Red. Easy to understand, easy to expand.

          1. Thanks for the info.

            Node-Red is a gui tool based on node.js framework. Can it be utilized in an android app?
            After-all one would like to have a simple android app for home automation.

            Off topic: Did you get any solution for online MQTT app apart from MyMQTT?

        2. ashubhatt – ot answer your question on Node-Red – I’m running it on a Raspberry Pi and there are loads of ways of getting Android and Node-Red talking. Websockets, HTTP/HTTPS come to mind. I’m also using NETIO on my Android phone and talking to Node-Red via TCP…

          1. Thanks a lot for the idea.
            Could you probably point me in the right direction from where I should start to understand the communication between Node red and Netio.

            If it’s not too much, could you please write a blog on the same. That would be very much helpful.

  4. just discovered domoticz…very interesting! expecially because it runs on openwrt…
    keep us updated! 🙂

Comments are closed.