Jump to content
C4 Forums | Control4
  • 0

Can I update devices like thermostats but from the Berto MQTT driver, or any webhook type of one?


416to305

Question

Hi everyone, hopefully I can explain this properly but just wondering if this is something that can be done with C4 or if a driver has to be made for it.  I'll use MQTT as an example with the Berto IoT Gateway that I have set up today but this would apply to any driver like the HTTP webhook one that receives external commands.  With this, I can do things like subscribe to a topic like "zwave/kitchen_temperature" which can publish a message such as the temperature like "70" and so on.  I can then easily trigger events in C4, such as "if topic zwave/kitchen_temperature receives a message, do XYZ."

My question though is, can I use data from something like this but to actually update a C4 device? 

- Create a thermostat/temperature device in C4 like you would for any device

- Not bind it to any input sensor or temperature sensor

- Use the Berto MQTT driver subscribing to the zwave/kitchen_temperature topic

- Have Home Assistant every 5 minutes publish the current temperature in Fahrenheit to the zwave/kitchen_temperature topic

- Have C4 receive that message, and update the C4 Temperature sensor device to be the received temperature

So, almost like the Berto MQTT driver is the relay that receives the temperature and then updates it in C4.

I tried via programming but there's no actions that let you set the temperature sensor value, since it understandably wants to retrieve it from something connected to it.  I have tons of z-wave and other devices in Home Assistant that I can easily control from C4 via MQTT, but just wondering if there's a way to do the reverse and update devices in C4 based on MQTT, or if that is getting into custom driver territory.  Thanks!

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0
On 4/21/2022 at 8:15 PM, 416to305 said:

Hi everyone, hopefully I can explain this properly but just wondering if this is something that can be done with C4 or if a driver has to be made for it.  I'll use MQTT as an example with the Berto IoT Gateway that I have set up today but this would apply to any driver like the HTTP webhook one that receives external commands.  With this, I can do things like subscribe to a topic like "zwave/kitchen_temperature" which can publish a message such as the temperature like "70" and so on.  I can then easily trigger events in C4, such as "if topic zwave/kitchen_temperature receives a message, do XYZ."

My question though is, can I use data from something like this but to actually update a C4 device? 

- Create a thermostat/temperature device in C4 like you would for any device

- Not bind it to any input sensor or temperature sensor

- Use the Berto MQTT driver subscribing to the zwave/kitchen_temperature topic

- Have Home Assistant every 5 minutes publish the current temperature in Fahrenheit to the zwave/kitchen_temperature topic

- Have C4 receive that message, and update the C4 Temperature sensor device to be the received temperature

So, almost like the Berto MQTT driver is the relay that receives the temperature and then updates it in C4.

I tried via programming but there's no actions that let you set the temperature sensor value, since it understandably wants to retrieve it from something connected to it.  I have tons of z-wave and other devices in Home Assistant that I can easily control from C4 via MQTT, but just wondering if there's a way to do the reverse and update devices in C4 based on MQTT, or if that is getting into custom driver territory.  Thanks!

U need to write ur own driver for this, not sure u can do that with C4 proxies thought

Link to comment
Share on other sites


  • 0
On 4/21/2022 at 7:15 PM, 416to305 said:

Hi everyone, hopefully I can explain this properly but just wondering if this is something that can be done with C4 or if a driver has to be made for it.  I'll use MQTT as an example with the Berto IoT Gateway that I have set up today but this would apply to any driver like the HTTP webhook one that receives external commands.  With this, I can do things like subscribe to a topic like "zwave/kitchen_temperature" which can publish a message such as the temperature like "70" and so on.  I can then easily trigger events in C4, such as "if topic zwave/kitchen_temperature receives a message, do XYZ."

My question though is, can I use data from something like this but to actually update a C4 device? 

- Create a thermostat/temperature device in C4 like you would for any device

- Not bind it to any input sensor or temperature sensor

- Use the Berto MQTT driver subscribing to the zwave/kitchen_temperature topic

- Have Home Assistant every 5 minutes publish the current temperature in Fahrenheit to the zwave/kitchen_temperature topic

- Have C4 receive that message, and update the C4 Temperature sensor device to be the received temperature

So, almost like the Berto MQTT driver is the relay that receives the temperature and then updates it in C4.

I tried via programming but there's no actions that let you set the temperature sensor value, since it understandably wants to retrieve it from something connected to it.  I have tons of z-wave and other devices in Home Assistant that I can easily control from C4 via MQTT, but just wondering if there's a way to do the reverse and update devices in C4 based on MQTT, or if that is getting into custom driver territory.  Thanks!

You may want to look at the v2 release of my drivers which are still in beta but ready to test.
 
They do not require registration and there is no need for a Premium licence to run multiple instances of the same driver, as with the v1 release.

The main driver, a new agent driver called Berto Agent, will provide the ability for any developer to write there own drivers and integrate with features such as MQTT, Mail, IFTTT, Pushover, REST interfaces, installing and renaming drivers etc. I’ll also be providing some example drivers with source code showing how to integrate with Berto Agent.
 
The REST Interface also allows updating of Profile locations from the OwnTrack app or using curl.

Effectively this means you can create your own integrations using MQTT.

The Berto Agent driver does not need to connect to any authorisation servers to work. Connections are still made to the Berto Cloud but only to use the additional services such as MQTT, Email, IFTTT etc.
 
Find enclosed link to initial release of v2 beta drivers, https://beta.berto.io/drivers.
 
You need to install the Berto_Agent.c4z driver first as an Agent driver in Composer ie. From the Agents tab.
 
See the docs on Berto Agent to explain basic use etc.
 
Source code is provided with the Berto_MQTT.c4z and Berto_Mail.c4z drivers.
 
The other drivers are free to use.
 
 
Thanks 
 
David
Link to comment
Share on other sites

  • 0

Thank you I'll check this soon!  I was coming on here to post actually a separate question about MQTT regarding this driver so maybe here will work.

I have Mosquitto installed on my Home Assistant Rapsberry Pi as the broker.  I have a few super basic automations like when topic "huekitchen" is received, with message "tokyo" activate the Tokyo Hue Dynamic scene and so on and it works great.

The issue I have though is any time the power goes out or network reboots, it completely stops working until I reboot Director.  If I try to issue MQTT commands from C4 to my broker nothing happens; however, if I issue the same message from other systems, it works every time including if I issue them from the broker as a test, which makes me think it's something with C4.  I then have to reboot my controller and it instantly starts working again.

I could have sworn I saw in a log somewhere something about a rate limit but I can't find that anymore.  I saw there were various tiers of pricing or something but couldn't find a breakdown as to what that was or if that might be the issue.  It almost reminds me of being blacklisted, like as if C4 is sending messages to the broker but they aren't being received so it then blacklists C4 until I reboot it or something.   I just don't know if it's a MQTT broker issue or C4, but it 100% ALWAYS resolves itself by rebooting the controller.  I even added an experience button "Reboot Director" on the T4 because it happens so frequently.

I was actually about to admit defeat and uninstall the driver and give up, but this beta one maybe gives me hope to try lol.  Does the issue I'm having seem familiar at all or any idea what might cause that?

Link to comment
Share on other sites

  • 0

So, quick update, I removed the old Berto drivers and then added these new ones.  They worked and I could publish MQTT messages to my broker and all was well.  When I got up this morning though nothing would work any more, even logging into Composer and trying to publish a message the broker would never receive it.  If I use my other systems and publish messages the broker receives them right away, so it's only C4 that stops working.  I then reboot Director and immediately it starts working again.  It will be good for maybe 24 hours and then back to just doing nothing until I reboot Director.  Wish I had more luck with this but I can't keep it working for more than a day before it stops, so I will stick to the Generic TCP driver instead of MQTT as I have spent way too long already on this. :) Thanks!

Link to comment
Share on other sites

  • 0
On 4/26/2022 at 5:40 PM, 416to305 said:

So, quick update, I removed the old Berto drivers and then added these new ones.  They worked and I could publish MQTT messages to my broker and all was well.  When I got up this morning though nothing would work any more, even logging into Composer and trying to publish a message the broker would never receive it.  If I use my other systems and publish messages the broker receives them right away, so it's only C4 that stops working.  I then reboot Director and immediately it starts working again.  It will be good for maybe 24 hours and then back to just doing nothing until I reboot Director.  Wish I had more luck with this but I can't keep it working for more than a day before it stops, so I will stick to the Generic TCP driver instead of MQTT as I have spent way too long already on this. :) Thanks!

The Agent driver will attempt to re-connect to the MQTT Broker if it misses a keep alive.

Update to Berto Agent Beta 1.3 should fix this issue. You need to have the Keepalive & Timeout set in the Broker configuration.

Have you written your own driver to use the MQTT client in the Agent?

Link to comment
Share on other sites

  • 0

I haven't written any driver, I was just using it via programming to do actions like "Publish MQTT message."  It was just weird as it would work for a day or so and then stop until I reboot the controller then it works again.  Maybe it's something with the keepalive and timeout settings, but I never configured those on my other devices that use MQTT and they always publish fine.  

Having said that, I'm dumb and just realized that Home Assistant supports webhooks for triggers, making MQTT unnecessary as I was only using MQTT to trigger events on Home Assistant (mainly Philips Hue Dynamics scenes and multi coloured lightstrip scenes which C4 doesn't support).  Right now I'm just using the Generic TCP Driver to make HTTP POST requests and it works great, so I will leave it as this!

Link to comment
Share on other sites

  • 0
On 4/21/2022 at 2:15 PM, 416to305 said:

Hi everyone, hopefully I can explain this properly but just wondering if this is something that can be done with C4 or if a driver has to be made for it.  I'll use MQTT as an example with the Berto IoT Gateway that I have set up today but this would apply to any driver like the HTTP webhook one that receives external commands.  With this, I can do things like subscribe to a topic like "zwave/kitchen_temperature" which can publish a message such as the temperature like "70" and so on.  I can then easily trigger events in C4, such as "if topic zwave/kitchen_temperature receives a message, do XYZ."

My question though is, can I use data from something like this but to actually update a C4 device? 

- Create a thermostat/temperature device in C4 like you would for any device

- Not bind it to any input sensor or temperature sensor

- Use the Berto MQTT driver subscribing to the zwave/kitchen_temperature topic

- Have Home Assistant every 5 minutes publish the current temperature in Fahrenheit to the zwave/kitchen_temperature topic

- Have C4 receive that message, and update the C4 Temperature sensor device to be the received temperature

So, almost like the Berto MQTT driver is the relay that receives the temperature and then updates it in C4.

I tried via programming but there's no actions that let you set the temperature sensor value, since it understandably wants to retrieve it from something connected to it.  I have tons of z-wave and other devices in Home Assistant that I can easily control from C4 via MQTT, but just wondering if there's a way to do the reverse and update devices in C4 based on MQTT, or if that is getting into custom driver territory.  Thanks!

Hi,

May I ask how you were able to publish MQTT message to home assistant? I can't seem to wrap my head around it. PLEASE HELP!!!

 

Thanks

Capture.JPG

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.