Closed jmcollin78 closed 7 months ago
last_ssen is not transmitted into stateChange which are the base of the event system. There is two datetime: last_changed and last_updated. But in all my test, there are always equal.
2024-03-27 18:54:50.385 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat chambre - !!!Temperature changed. Event.new_state is <state sensor.temperature_chambre=17.6; state_class=measurement, unit_of_measurement=°C, device_class=temperature, friendly_name=Température chambre @ 2024-03-27T18:54:50.101482+01:00>, last_changed=2024-03-27 17:54:50.101482+00:00, last_updated=2024-03-27 17:54:50.101482+00:00
2024-03-27 18:54:50.397 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat mezzanine - !!!Temperature changed. Event.new_state is <state sensor.temperature_mezzanine=18.3; state_class=measurement, unit_of_measurement=°C, device_class=temperature, friendly_name=Température mezzanine @ 2024-03-27T18:54:50.120499+01:00>, last_changed=2024-03-27 17:54:50.120499+00:00, last_updated=2024-03-27 17:54:50.120499+00:00
2024-03-27 18:54:50.542 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat entrée - !!!Temperature changed. Event.new_state is <state sensor.temperature_entree=17.6; state_class=measurement, unit_of_measurement=°C, device_class=temperature, friendly_name=Température entrée @ 2024-03-27T18:54:50.138530+01:00>, last_changed=2024-03-27 17:54:50.138530+00:00, last_updated=2024-03-27 17:54:50.138530+00:00
2024-03-27 18:54:50.559 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat musique - !!!Temperature changed. Event.new_state is <state sensor.temperature_musique=14.7; state_class=measurement, unit_of_measurement=°C, device_class=temperature, friendly_name=Température musique @ 2024-03-27T18:54:50.206820+01:00>, last_changed=2024-03-27 17:54:50.206820+00:00, last_updated=2024-03-27 17:54:50.206820+00:00
2024-03-27 18:54:50.643 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat sdb - !!!Temperature changed. Event.new_state is <state sensor.temperature_sdb=16.9; state_class=measurement, unit_of_measurement=°C, device_class=temperature, friendly_name=Température SDB @ 2024-03-27T18:54:50.314062+01:00>, last_changed=2024-03-27 17:54:50.314062+00:00, last_updated=2024-03-27 17:54:50.314062+00:00
2024-03-27 18:56:31.620 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat bureau - !!!Temperature changed. Event.new_state is <state sensor.temperature_bureau=20.1; raw_state=20.1, unit_of_measurement=°C, device_class=temperature, friendly_name=Température bureau @ 2024-03-27T18:56:31.607444+01:00>, last_changed=2024-03-27 17:56:31.607444+00:00, last_updated=2024-03-27 17:56:31.607444+00:00
So there is nothing I can do.
Thanks @jmcollin78 for looking. I will test this solution :
Yes this seems the best solution:
No so easy but can be easier with a Blueprint if someone wants to make one ...
I could also add an optionnal last_seen sensor in VTherm configuration. But it is really a great complexity for newbye user to handle this.
Hello Jean-Marc, I performed update 6.2 and I activated the visibility of the last_seen sensor of my Sonoff SNZB-02D What other settings should I make in the Vterm configuration so that the temperature is correctly supported with my thermometer?
Hello @LaurentFrx ,
You have to add the last_seen in the configuration of your VTherm. Just below the temperature sensor:
I will add this in the README.
@jmcollin78 Thank you for your fix !
So I must just use the last_seen state of my Sonoff SNZB-02D entity in the VTherm ?
I must not create other computed entity or do something else like you say here ? https://github.com/jmcollin78/versatile_thermostat/issues/398#issuecomment-2023539313
Yes, I have done this improvement to be able to use it directly.
Perfect thank you ! I set last_seen on my VTherm.
Done ! Thanks a lot J-M !
@jmcollin78 I'm sorry but I think this fix doesn't work. Like you can see on my screenshots, last_seen state updated 1 minute ago. But my therm is in security mode. Do you know if I forget something ? Thank you
Hello @barbierp35 ,
Can you send me the logs please around the last_seen change. It should have some notifications in VTherm logs.
EDIT: you won't see the logs as is. You have to integrate this line in your logger.yaml configuration (or configuration.yaml depending of ytour configuration):
custom_components.versatile_thermostat.base_thermostat: debug
Are you in 6.2.1 release ?
You should see logs like that:
2024-04-02 09:47:56.958 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat chambre - Last seen temperature changed. Event.new_state is <state sensor.thermometre_chambre_last_seen=2024-04-02T07:47:56+00:00; device_class=timestamp, icon=mdi:clock, friendly_name=Thermomètre chambre Last seen @ 2024-04-02T09:47:56.922297+02:00>
2024-04-02 09:47:56.958 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat chambre - last_change_time is now 2024-04-02 09:47:56.958913+02:00
2024-04-02 09:47:56.959 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat chambre - new last_temperature_measure is now: 2024-04-02 09:47:56.922297+02:00
This is the proof it is working if you can see that.
Just to be sure, you send screen copy of the cuisine thermometer but the thermostat in security is named "Pièce de vie". Is that normal ?
Hello @jmcollin78 ! Sorry for response delay.
To beginning, I was not in 6.2.1 release but in 6.2.0. I updated to 6.2.1 just now.
Also, the thermometer of "Pièce de vie" is named "Cuisine" because my kitchen is in my living room. So I put thermometer in my kitchen.
I add logger: !include logger.yaml
in my configuration.yaml file.
And this is my logger.yaml file :
Now, I see logs, and I have this :
2024-04-10 22:47:17.835 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - Last seen temperature changed. Event.new_state is <state sensor.thermometre_cuisine_last_seen=2024-04-10T20:46:23+00:00; battery=100, humidity=61.5, last_seen=2024-04-10T20:46:23.838Z, linkquality=120, temperature=17.5, device_class=timestamp, icon=mdi:clock, friendly_name=Thermomètre cuisine Last seen @ 2024-04-10T22:47:17.808669+02:00>
2024-04-10 22:47:17.836 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - last_change_time is now 2024-04-10 22:47:17.836241+02:00
2024-04-10 22:47:17.836 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - new last_temperature_measure is now: 2024-04-10 22:47:17.808669+02:00
I've had the security error today, but I did not set logger in configuration.yaml. And sometimes, I must wait a few days before having this error. So do you want I wait a new error to send you logs ?
So the last_seen is working on your side. You can remove the debug log. That is what I want to see. Because debug mode is very verbose, don't stay too much with debug mode on.
If you want more information, can I keep the logs enabled until I have security enabled again?
Yesterday at 6am I had the problem. I saw in the logs that security mode was power on. The problem is that, by installing SSH on my home assistant, I lost all the logs.
But when I saw the security activation in the logs, the log to report it was at 6am. But in this log, it was noted that the last_seen was at 4am. I'm not sure, but I think I saw this.
Maybe I have a problem with the GMT in the date configuration ?
@jmcollin78 This log screen confirm what I said. The last_seen is 2 hours before the actual hour :
Do you know how can I repair this please ?
Thank you
Please don't post logs as image. I can't search in it.
If I see well, last_seen date are in UTC so they have two hours less that GMT which is normal in summer time. I don't think there is an issue at this point.
+00 means UTC (so Paris time - 2 h)
Ok sorry, do you want others logs without image ?
I was thinking that the problem might be coming from the fact that you were looking at the last_seen without taking into account that it is in UTC and not GMT +2.
If you want more informations to fix this issue, you can say me what you want.
Thank you
Hello @jmcollin78 ,
I thought of something about my issue. I activated the last_seen on zigbee2mqtt, but I not set the availability
time for active and passives devices in zigbee2mqtt configuration.
So value are never "unavailable". Do you think if I active the availability
like you can see here, your fix will work ?
https://www.hacf.fr/zigbee2mqtt-availability/#affichage-%E2%80%9Cdisponibilit%C3%A9%E2%80%9D
Thank you
Hello @barbierp35 ,
I not sure but I don't think availability and last_seen are correlated. But it is a good idea to implement availability specially for open door sensors and thermometer because you want to know if they are alive or not. So you can activate it.
From what I see in the log your last_seen is working. Please give me the log in text mode when the wsecurity mode is triggered so that I will be able to see what happens.
Did you install the Versatile Thermosstat UI ? If yes, when the VTherm goes into security mode, it tells what thermometer is missing. Something like that :
See https://github.com/jmcollin78/versatile-thermostat-ui-card.
You can also disable the security mode on external temperature sensor. See README:
versatile_thermostat:
...
safety_mode:
check_outdoor_sensor: false
@jmcollin78 Thank you for your answer.
Like you can see, the error is with the internal temp, like I can see with the Thermostat UI.
I wait for a new error with security mode and I will send you logs in text format
Hello @jmcollin78,
I just have the error. I send you logs in text format. I hope you find a solution for this issue with my logs.
Thank you
2024-04-30 17:15:37.450 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - Set target temp: 18.5
2024-04-30 17:15:37.452 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - No temperature received for more than 60.0 minutes (dt=104.2, dext=1.2) and on_percent (55.00 %) is over defined value (50.00 %). Set it into safety mode
2024-04-30 17:15:37.452 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.TEMPERATURE_EVENT with data: {'last_temperature_measure': '2024-04-30T15:31:26.318780+02:00', 'last_ext_temperature_measure': '2024-04-30T17:14:24.548561+02:00', 'current_temp': 17.6, 'current_ext_temp': 17.1, 'target_temp': 18.5}
2024-04-30 17:15:37.452 INFO (MainThread) [custom_components.versatile_thermostat.prop_algorithm] Thermostat pièce de vie - Proportional Algo - set security to ON
2024-04-30 17:15:37.452 INFO (MainThread) [custom_components.versatile_thermostat.prop_algorithm] Thermostat pièce de vie - Security is On using the default_on_percent 0.100000
2024-04-30 17:15:37.452 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - Set preset_mode: security force=False
2024-04-30 17:15:37.452 INFO (MainThread) [custom_components.versatile_thermostat.prop_algorithm] Thermostat pièce de vie - Security is On using the default_on_percent 0.100000
2024-04-30 17:15:37.453 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.PRESET_EVENT with data: {'preset': 'security'}
2024-04-30 17:15:37.453 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.SECURITY_EVENT with data: {'type': 'start', 'last_temperature_measure': '2024-04-30T15:31:26.318780+02:00', 'last_ext_temperature_measure': '2024-04-30T17:14:24.548561+02:00', 'current_temp': 17.6, 'current_ext_temp': 17.1, 'target_temp': 18.5}
2024-04-30 17:15:37.461 INFO (MainThread) [custom_components.versatile_thermostat.underlyings] VersatileThermostat-Thermostat pièce de vie-switch.chauffage_salon - start heating for 0 min 30 sec
2024-04-30 17:15:55.332 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - End of safety mode. restoring hvac_mode to heat and preset_mode to none
2024-04-30 17:15:55.332 INFO (MainThread) [custom_components.versatile_thermostat.prop_algorithm] Thermostat pièce de vie - Proportional Algo - set security to OFF
2024-04-30 17:15:55.332 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - Set preset_mode: none force=False
2024-04-30 17:15:55.333 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.PRESET_EVENT with data: {'preset': 'none'}
2024-04-30 17:15:55.333 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.SECURITY_EVENT with data: {'type': 'end', 'last_temperature_measure': '2024-04-30T17:15:55.330511+02:00', 'last_ext_temperature_measure': '2024-04-30T17:14:24.548561+02:00', 'current_temp': 17.6, 'current_ext_temp': 17.1, 'target_temp': 18.5}
2024-04-30 17:15:55.343 WARNING (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - No temperature received for more than 60.0 minutes (dt=104.5, dext=1.5) and on_percent (55.00 %) is over defined value (50.00 %). Set it into safety mode
2024-04-30 17:15:55.343 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.TEMPERATURE_EVENT with data: {'last_temperature_measure': '2024-04-30T15:31:26.318780+02:00', 'last_ext_temperature_measure': '2024-04-30T17:14:24.548561+02:00', 'current_temp': 17.6, 'current_ext_temp': 17.1, 'target_temp': 18.5}
2024-04-30 17:15:55.343 INFO (MainThread) [custom_components.versatile_thermostat.prop_algorithm] Thermostat pièce de vie - Proportional Algo - set security to ON
2024-04-30 17:15:55.344 INFO (MainThread) [custom_components.versatile_thermostat.prop_algorithm] Thermostat pièce de vie - Security is On using the default_on_percent 0.100000
2024-04-30 17:15:55.344 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat pièce de vie - Set preset_mode: security force=False
2024-04-30 17:15:55.344 INFO (MainThread) [custom_components.versatile_thermostat.prop_algorithm] Thermostat pièce de vie - Security is On using the default_on_percent 0.100000
2024-04-30 17:15:55.345 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.PRESET_EVENT with data: {'preset': 'security'}
2024-04-30 17:15:55.345 INFO (MainThread) [custom_components.versatile_thermostat.const] VersatileThermostat-Thermostat pièce de vie - Sending event EventType.SECURITY_EVENT with data: {'type': 'start', 'last_temperature_measure': '2024-04-30T15:31:26.318780+02:00', 'last_ext_temperature_measure': '2024-04-30T17:14:24.548561+02:00', 'current_temp': 17.6, 'current_ext_temp': 17.1, 'target_temp': 18.5}
2024-04-30 17:16:07.463 INFO (MainThread) [custom_components.versatile_thermostat.underlyings] VersatileThermostat-Thermostat pièce de vie-switch.chauffage_salon - stop heating for 4 min 30 sec
Hello @barbierp35 ,
This is now clear: VTherm doesn't receive nor temperature change nor last_seen since 'last_temperature_measure': '2024-04-30T15:31:26.318780+02:00'
I think that you can verify in the log that you will not find log like: "Last seen temperature changed. Event.new_state"
You have to change your temperature sensor I guess. What is your temperature sensor. I can suggest SONOFF SNZB-02D if you look for one which works well.
@jmcollin78 I restarted HA several times after making changes so I no longer have logs. But when it happens again, I will check if I have the log : "Last seen temperature changed. Event.new_state".
For information, my temperature sensor is already a Sonoff SNZB-02D. I don't understand why there isn't many people with this issue.
I don't understand why there isn't many people with this issue.
There is only one explanation: you have a local configuration that makes this.
Here is my configuration of Z2M and one sensor, may be it will helps:
Z2M configuration:
data_path: /config/zigbee2mqtt
socat:
enabled: false
master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
options: "-d -d"
log: false
mqtt:
server: mqtt://192.168.xxx.xxxx1883
base_topic: zigbee2mqttHA
user: xxxx
password: xxxxx
serial:
adapter: ember
port: >-
/dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_xxxxxx-if00-port0
baudrate: 115200
rtscts: false
advanced:
channel: 20
log_level: debug
Note that I'm with the Skyconnect key, flashed with 4.1 firmware (as far I can remember). I switch to the ember adapter which was much more stable (I loose many Zigbee devices regularly before I switch to ember)
@jmcollin78 Thank you for your configuration. But I have exactly the same configuration. I never edit this configuration in zigbee2mqtt interface :
For zigbee2mqtt/configuration.yaml, this is my file. I don't see any error.
But last_seen
parameter has ISO_8601
for value. Do you have this or you have ISO_8601_local
?
external_converters: []
devices:
- devices.yaml
groups:
- groups.yaml
homeassistant: true
permit_join: false
mqtt:
base_topic: zigbee2mqtt
user: addons
password: XXXXXX
server: mqtt://core-mosquitto:1883
serial:
port: /dev/ttyUSB0
adapter: ezsp
advanced:
log_level: warn
pan_id: 6754
channel: 11
network_key:
- 1
- 3
- 5
- 7
- 9
- 11
- 13
- 15
- 0
- 2
- 4
- 6
- 8
- 10
- 12
- 13
availability_blocklist: []
availability_passlist: []
log_syslog:
app_name: Zigbee2MQTT
eol: /n
host: localhost
localhost: localhost
path: /dev/log
pid: process.pid
port: 514
protocol: udp4
type: '5424'
last_seen: ISO_8601
device_options: {}
blocklist:
- '0x84b4dbfffead68c7'
passlist: []
queue: {}
frontend:
port: 8099
experimental: {}
availability: false
And my zigbee key is a Zigbee Popp. I never had any issue with this key.
I don't have the last_seen: ISO_8601 configured on the config file. If I look on the interface I see that:
Thank you. So I dont know what is my problem. I will check for the "Last seen temperature changed. Event.new_state" log.
cf. https://forum.hacf.fr/t/quelles-sondes-de-temperature-pour-gestion-de-chauffage/29066/48