#sensor value to mqtt

1 messages · Page 1 of 1 (latest)

cinder merlin
#

hi,
i want to send an ha sensor value to mqtt.
atm i do that with an automation and mqtt.publish.
the automation is triggeres every second or less.
is there another way to do that?
maybe with less resources?

gilded sparrow
#

Why not just do it when the sensor value changes? (state trigger)

cinder merlin
#

thats the case

#

it changes very oftn and should be transmitted immediately

#

the question is if it exists another way to do that.

gilded sparrow
#

Ah OK. So it's not updating every second, it's updating when the sensor updates which happens to be every second. Gotcha.

cinder merlin
#

jep

gilded sparrow
#

Honestly, not through home assistant - if you want to transmit every change, and it's updating that frequently, then there's no real way around just sending the event

cinder merlin
#

is there a way to do that an other way than with an automation?

#

i need the energy sensor value of the tibber integration as mqtt

gilded sparrow
#

As for doing it with less resources (not that an automation running every second is particularly problematic) it depends on the sensor, but publishing directly to mqtt would be easier than reading to ha then republish to mqtt

#

Ah I see, so virtual sensor not like a esphome device

cinder merlin
#

yes

gilded sparrow
#

Why does it need to be updated so instantly, what are you running off it?

cinder merlin
#

the mqtt value is read by opendtuonbattery as energy meter value

#

and used to to build an "nulleinspeisung" with an hm800

#

so it should be near realtime as possible

gilded sparrow
#

I see

#

And what issues is the automation causing?

cinder merlin
#

it is a bit slow and i want to know if there are better ways to do that

gilded sparrow
#

I don't know how effective it is, polling rates etc

cinder merlin
#

i know that, but i dont want to ask the api twice

#

the ha integration uses the api too

gilded sparrow
#

Yeah but the software implementation controls when it queries the api

cinder merlin
#

hm

gilded sparrow
#

And I can't imagine the ha integration and that work exactly the same. Could be better or worse, idk

#

There might be other options but that's what I'd suggest trying at least

cinder merlin
#

ok

#

so i need an extra task on another machine

#

there are also php, bash and java implementations

#

i will give them a try.

#

so with ha it is best done with the automation thing, right?