Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: add basic mqtt support #265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

mhdawson
Copy link

  • add support for mqtt
  • when message is posted to configured topic it will be displayed immediately and then each time messages are srolled.
  • send an empty message to clear the mqtt message added to the scroll

- add support for mqtt
- when message is posted to configured topic
  it will be displayed immediately and then each
  time messages are srolled.
- send an empty message to clear the mqtt message
  added to the scroll

Signed-off-by: Michael Dawson <mdawson@devrus.com>
@mhdawson
Copy link
Author

If I need to add any additional doc/explanation just let me know.

@Qrome
Copy link
Owner

Qrome commented Feb 21, 2023

@mhdawson -- just from looking over the code, it looks like you have hit the main parts. Web interface, configuration and display as well as save and read from the config. I will try and make some time tonight to test the compile before merging. I do not have a MQTT server to test it with however.

@mhdawson
Copy link
Author

@Qrome thanks. I've tested it by hand, sending mqtt messages etc. and configuring through the UI.

@mhdawson
Copy link
Author

mhdawson commented Mar 4, 2023

@Qrome I'm going to be away for a few weeks so if you have any comments/suggested updates I'll do those when I get back.

@Qrome
Copy link
Owner

Qrome commented Mar 4, 2023

@Qrome I'm going to be away for a few weeks so if you have any comments/suggested updates I'll do those when I get back.

Thanks!

@mhdawson
Copy link
Author

@Qrome back. If it helps I could probably set up a public mqtt server temporarily so you could try it out.

@dirtmover
Copy link

I've just built a load with this change and it seems to be working well. Any chance it will be merged any time soon?

@mhdawson
Copy link
Author

@Qrome if you need any more info or anything else from me on this PR just let me know.

@brainrecall
Copy link

Hi @mhdawson
I was just looking to update my marquee clock to display a sensor temperature, and I discovered your PR for the MQTT displaying. I think that will work well enough, I can craft the display string on Home Assistant.

However, I noticed you do not have the ability to set the MQTT user or password, something I'll need (and I suspect a lot of other people). My fork is an amalgamation of things, so I'm not sure if my fork is the cleanest place for me to change things, but I will likely hack in the user/pass into Settings.h for now. I'd thought I'd let you know that you should consider adding the ability to set them from the UI.

@brainrecall
Copy link

Yeah, this MQTT addition to the clock is very powerful. With Home Assistant, you can pretty much display anything to the clock with a bit of templating on an automation. I'd thought I'd share on what I'm doing. In my case, I'm not using the built-in weather, instead I'm just displaying the air tempertaure from one of my existing sensors thats tied into Home Assitant. Likewise, I have a temperature sensor for my pool, which I also have in Home Assistant. This automation publishes to MQTT every 30 seconds, which in turn gets displayed to the pool-side clock. Slick!

alias: Pool Clock Temperatures
description: ""
trigger:
  - platform: time_pattern
    seconds: "00"
  - platform: time_pattern
    seconds: "30"
condition: []
action:
  - service: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: pool/temps
      payload_template: >-
        Air: {% set state = states('sensor.outside_temperature') %}{{ state |
        round(0) if is_number(state) else 0}}°F  Pool: {% set state =
        states('sensor.pool_temperature_ds18b20_temperature') %}{{ state |
        round(0) if is_number(state) else 0}}°F
mode: single

@mhdawson
Copy link
Author

@brainrecall I agree that authentication is a good next step. Once/if this lands my next thing to do was to add the ability to configure certificates because I use that for access to a more publicly accessible server. Also supporting userid/password as part of that makes sense because ideally those would shared over a secure connection.

@brainrecall
Copy link

@mhdawson Ah, that sounds great. I'm using a very private server so crappy passwords are good enough for me.

One thing I did notice, but hadn't the time to look at yet, was the degree symbol I sent from Home Assistant shows garbled on the display. Obviously the marquee doesn't understand Unicode, so someplace it'll need to translate to one of the printable characters supported by the matrix. I might hack that in someplace as well; thought I'd let you know.

@Bokenbergen
Copy link

Could you please compile this to a .bin file so we can upgrade from web ui?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants