Home Assistant + MQTT, more than lighting?

Discussion in 'Third-Party Solutions' started by arrikhan, Dec 13, 2020.

  1. arrikhan

    arrikhan

    Joined:
    Oct 16, 2011
    Messages:
    48
    Likes Received:
    6
    Location:
    Australia
    I have setup cgateweb wtih MQTT , CGATE and Home Assistant recently.

    Am wondering if any other topics can be subscribed to other than lighting?

    I'd like to be able to read CBUS temp sensors from CGATE since its posting that data regularly on measurement app. I also have irrigation.

    Anyone have any luck with this?

    Regards,

    BenC
     
    arrikhan, Dec 13, 2020
    #1
  2. arrikhan

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    i dont, but im very interested in this also!
     
    zei20t, Dec 14, 2020
    #2
  3. arrikhan

    Ks04

    Joined:
    Dec 28, 2019
    Messages:
    107
    Likes Received:
    9
    I did mine slightly differently so i could get the temp sensors and other items working:
    Cbus --> HomeBridge (Homekit) --> Home Assistant

    Works well, and i get the full history of temperatures (interesting to compare in vs out over time).

    I also have integrations going the otherway, so I can trigger sonos to play/pause/next from the eDLT for example based on certain groups turning on/off/level.

    Still a work in progress, but getting there. Best bit is it works on the SHAC touchscreen (after you update the firmware to the latest version of android via the OEM's website), so have now ditched the SHAC in favour of this.
     

    Attached Files:

    Ks04, Dec 14, 2020
    #3
    Blade, Robert and zei20t like this.
  4. arrikhan

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    228
    Likes Received:
    47
    Assuming you are using the CGate to MQTT from https://github.com/the1laz/cgateweb
    Steven has only coded it to work with the lighting application - 56

    There was a fork created to work with HVAC application - https://github.com/mminehanNZ/cgateweb which you may be able to tweak to work with the temp application or if you have a SHAC/NAC you can publish your temps via MQTT with a LUA script.
    Code:
    -- Get temperature and units of channel 1 of sensor 1 on the local network
    -- temp is a float and units is a string (eg '°C')
    
    temp_rack = GetCBusMeasurement(0,166,1)
    temp_indoor = GetCBusMeasurement(0, 166, 2)
    temp_outdoor = GetCBusMeasurement(0, 166,3)
    temp_studio = GetCBusMeasurement(0, 26, 1)
    mqtt = require("mosquitto")
    
    client = mqtt.new()
    --log("created MQTT client", client)
    
    client.ON_CONNECT = function()
    --  log("connected to MQTT broker")
            local qos = 1
            local retain = false
      local mid = client:publish("temperatures/studio", temp_studio, qos, retain)
            local mid = client:publish("temperatures/rack", temp_rack, qos, retain)
            local mid = client:publish("temperatures/indoor", temp_indoor, qos, retain)
            local mid = client:publish("temperatures/outdoor", temp_outdoor, qos, retain)
    
    end
    
    client.ON_PUBLISH = function()
        client:disconnect()
     
    end
    
    broker = 'X.X.X.X' -- Broker ip adress
    client:connect(broker)
    client:loop_forever()
    
     
    Damaxx, Dec 16, 2020
    #4
  5. arrikhan

    arrikhan

    Joined:
    Oct 16, 2011
    Messages:
    48
    Likes Received:
    6
    Location:
    Australia
    Thanks @Damaxx !! You have just opened my world to new possibilities!

    This took all of 5 seconds to setup on my SHAC and post the temps every minute. There is so much automation to be done now ...:D

    BenC

     
    arrikhan, Jan 5, 2021
    #5
    Damaxx likes this.
  6. arrikhan

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    could this be modified to publish everything to an mqtt server to send and receive payloads?

    this would make cgate and an mqtt intermediary redundant
     
    zei20t, Jan 21, 2021
    #6
  7. arrikhan

    Robert

    Joined:
    Jun 10, 2018
    Messages:
    48
    Likes Received:
    1
    I've got the first two items worksing but not HA. Are you using the Homebridge MQTT plugin to get Homebridge to talk to HA or there another option?

    I really struggle with JSON, any edits can't be saved due to some error. On the face of it the syntax looks simple, structred but I'm clearly not 'getting' it. This it the instructions I've tried:
    https://github.com/cflurin/homebridge-mqtt#readme

    Thanks,
    Rob
     
    Robert, Feb 7, 2021
    #7
  8. arrikhan

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    228
    Likes Received:
    47
    Have a look at this one zei20t - https://github.com/Nick-Adams-AU/5500SHAC-Cbus2MQTT
     
    Damaxx, Feb 7, 2021
    #8
    zei20t likes this.
  9. arrikhan

    Robert

    Joined:
    Jun 10, 2018
    Messages:
    48
    Likes Received:
    1
    So the SHAC will talk to a MQTT broker directly?
     
    Robert, Feb 8, 2021
    #9
  10. arrikhan

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    228
    Likes Received:
    47
    Damaxx, Feb 8, 2021
    #10
    zei20t likes this.
  11. arrikhan

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    zei20t, Feb 9, 2021
    #11
  12. arrikhan

    norfolk

    Joined:
    Mar 29, 2021
    Messages:
    1
    Likes Received:
    1
    Hi all,

    Managed to get CBUS -> Cgate -> HomeBridge -> HA, and all without any lag/delay on an RPi4 to control lights and blinds. See https://github.com/anthonywebb/homebridge-cbus/ for full list of support devices.

    Steps to reproduce:
    1. Install Homebridge: https://homebridge.io/
    2. Install HA: https://www.home-assistant.io/
    3. Install Homekit Controller on HA: https://www.home-assistant.io/integrations/homekit_controller/
    4. Connect the Homebridge to HA via the Homekit Controller on HA.
    5. Connect CBUS to Homebridge: https://github.com/greiginsydney/Homebridge-cbus-installer
    6. On HA, go to Configuration -> Integrations -> Homekit Contoller -> Reload
    7. Give it a minute, and your devices should appear in HA.
    8. (Optional) Install the Homekit integration on HA: https://www.home-assistant.io/integrations/homekit/
      1. The connection QR/code given by the HA integration is the one you should connect with in your iOS app.
    Some notes:
    • I have found it is essential to connect Homebridge and HA (step 4), before completing step 5. Once the CBUS devices are loaded onto the Homebridge in step 5, initialising a connection between Homebridge and HA becomes impossible (granted, this could be due to the complexity of my local cbus network).
     
    Last edited: Mar 29, 2021
    norfolk, Mar 29, 2021
    #12
    zei20t likes this.
  13. arrikhan

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    130
    Likes Received:
    1
    Location:
    Sydney, Australia
    i ran HA and MQTT which was easier to manage than using homekit (in my opinion)

    pretty much any device or connection could stop and start and everything would pickup where it was again.

    now using a SHAC with Narkov's script to push all comms via MQTT and into HA removing the need for the cgate server.
     
    zei20t, Apr 9, 2021
    #13
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.