pepe2
(Pepe)
September 8, 2023, 2:43pm
1
Hi, I’am new to HA and I made a homemade zigbee device with a input ( button ) and a output (led) and a input value that shows the battery voltage. I paired the device and the button and led is working prefect in my automation. The voltage I don’t find as a entity. But I can see the voltage in → settings → device → “devicename” → devive info → MQTT info → if I go then to the 10 most recently received message(s) I get the info:
click: null
l2: 3.24
linkquality: 183
state_l1: ‘OFF’
voltage_l2: 3.2
click: null
l2: 3.24
linkquality: 183
state_l1: ‘OFF’
voltage_l2: 3.2
click: null
l2: 3.24
linkquality: 183
state_l1: ‘OFF’
voltage_l2: 3.2
You can see that there is no click on the button, l2 is the voltage of 3.24V, state_l1 is the led = OFF
and the voltage_l2 is 3.2V is the rounded value of l2.
Now I like the set the voltage on my dashboard, but I don’t find that entity in home assitant.
How can I do that?
Many thanks
francisp
(Francis)
September 8, 2023, 3:45pm
2
Check on your device info if it is a disabled sensor.
pepe2
(Pepe)
September 8, 2023, 4:19pm
3
I had a look at the device and the sensor is enabled. But now I see that the voltage is a attribute of the click entity. If i use the click entity I see only if I click on the button and not the voltage value. How can I see an attribute of an entity?
So , the info received from MQTT is from the click entity : and there is also the voltage as attribute
click: null
l2: 3.24
linkquality: 183
state_l1: ‘OFF’
voltage_l2: 3.2
see also picture:
francisp
(Francis)
September 8, 2023, 4:36pm
4
Can you look with mqtt explorer (https://mqtt-explorer.com/ ) on what topic you receive that message, and post the actual json ?
pepe2
(Pepe)
September 8, 2023, 4:49pm
5
Visvoeder = {“click”:null,“l2”:3.18,“linkquality”:191,“state_l1”:“OFF”,“voltage_l2”:3.2}
francisp
(Francis)
September 8, 2023, 4:58pm
6
so try this, under mqtt:
sensor:
- name: "visvoeder "
state_topic: "Visvoeder"
value_template: >-
{{ value_json.voltage_l2 }}
unit_of_measurement: 'V'
unique_id: "visvoeder_voltage"
pepe2
(Pepe)
September 8, 2023, 5:02pm
7
I added it to configuration.yaml and restart HA. Now I have to wait…
pepe2
(Pepe)
September 8, 2023, 5:12pm
8
Everything is back in HA
If I go to developer tools then I see :
The visvoeder is unknown ???
francisp
(Francis)
September 8, 2023, 5:15pm
9
if there was no message yet, it will be unknown until the first message received.
pepe2
(Pepe)
September 8, 2023, 5:21pm
10
yes there is already defferent messages
pepe2
(Pepe)
September 8, 2023, 5:35pm
11
I changed the “voltage_l2” to “l2” to see if I can change to the other attribute. But I get also unknown.
francisp
(Francis)
September 8, 2023, 5:37pm
12
sensor:
- name: "visvoeder "
state_topic: "Visvoeder"
value_template: "{{ value_json.voltage_l2 }}"
unit_of_measurement: 'V'
unique_id: "visvoeder_voltage"
pepe2
(Pepe)
September 8, 2023, 5:55pm
13
I still have the same unknown value.
In MQTT explorer I put also the json file to publish and still unknown value as result.
pepe2
(Pepe)
September 8, 2023, 5:57pm
14
it looks that it is working with you, but here still the same.
can it be in the configuration.yaml that I made a mistake?
pepe2
(Pepe)
September 8, 2023, 5:58pm
15
How can you send a piece of yaml code, so that it looks good?
francisp
(Francis)
September 8, 2023, 6:01pm
16
Format your code properly:
Before we begin…
This forum is not a helpdesk
The people here don’t work for Home Assistant, that’s an open source project. We are volunteering our free time to help others. Not all topics may get an answer, never mind one that helps you solve your problem.
[image]
This also isn’t a general home automation forum, this is a forum for Home Assistant and things related to it. Any question about Home Assistant, and about using things with Home Assistant, is welcome here. We can’t help you with e…
pepe2
(Pepe)
September 8, 2023, 6:04pm
18
mqtt:
sensor:
- name: "Kwartverbruik sim"
state_topic: "sm/kwsim"
qos: 0
unit_of_measurement: "W15min"
- name: "spanning L1"
state_topic: "sm/kwL1"
qos: 0
unit_of_measurement: "V"
- name: "spanning L3"
state_topic: "sm/kwL3"
qos: 0
unit_of_measurement: "V"
- name: "energy used"
state_topic: "sm/dagU"
qos: 0
unit_of_measurement: "Wh"
state_class: total
device_class: energy
- name: "energy returned"
state_topic: "sm/dagR"
qos: 0
unit_of_measurement: "Wh"
state_class: total
device_class: energy
- name: "Gas teller"
state_topic: "sm/gas"
qos: 0
unit_of_measurement: "m³"
state_class: total
device_class: gas
- name: "regenwaterput"
state_topic: "rw/proc"
qos: 0
unit_of_measurement: "%"
- name: "tvlift"
state_topic: "tv/op-neer"
qos: 0
- name: "visvoeder"
state_topic: "Visvoeder"
value_template: "{{ value_json.voltage_l2 }}"
unit_of_measurement: 'V'
unique_id: "visvoeder_voltage"
This is what is in my cofiguration.yaml under MQTT
francisp
(Francis)
September 8, 2023, 6:08pm
19
you are sure the state_topic is Visvoeder, and not visvoeder ? MQTT is case-sensitive.
pepe2
(Pepe)
September 8, 2023, 6:12pm
20
this is wat mqtt explorer gives: