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:
    47
    Likes Received:
    5
    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
    1. Advertisements

  2. arrikhan

    zei20t

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

  3. arrikhan

    Ks04

    Joined:
    Dec 28, 2019
    Messages:
    27
    Likes Received:
    3
    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
    zei20t likes this.
  4. arrikhan

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    190
    Likes Received:
    29
    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:
    47
    Likes Received:
    5
    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.
    1. Advertisements

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.