Qrome / marquee-scroller

Marquee Scroller Clock News Weather and More
https://www.thingiverse.com/thing:2867294
MIT License
324 stars 159 forks source link

src: add basic mqtt support #265

Open mhdawson opened 1 year ago

mhdawson commented 1 year ago
mhdawson commented 1 year ago

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

Qrome commented 1 year ago

@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 commented 1 year ago

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

mhdawson commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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

dirtmover commented 1 year ago

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 commented 1 year ago

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

brainrecall commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

@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 commented 7 months ago

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