I have a temperature sensor that send its value to a raspberry in HTTP. Raspberry send the value to homeassistant (install on the same raspberry) with a curl command. Then I can ask for the value with google assistant (like “ok google what is the temperature inside bedroom ?”)
Each time a curl command is made sensor value inside homeassistant update well. But google assistant command work well only for the first update of the value. In the second update, google assistant answer that it doesn’t find the sensor.
My configuration file :
template:
- sensor:
- name: "temperature bedroom"
unique_id: "temperature_bedroom_uniq_id"
unit_of_measurement: "°C"
state: '{{ states("sensor.temperature_bedroom") }}'
device_class: temperature
- name: "humidity bedroom"
unique_id: "humidity_bedroom_uniq_id"
unit_of_measurement: "%"
state: '{{ states("sensor.humidity_bedroom") }}'
device_class: humidity
google_assistant:
project_id: myproject-83459
service_account: !include xxxxx.json
report_state: true
exposed_domains:
- sensor
entity_config:
sensor.temperature_bedroom:
expose: true
room: "bedroom"
sensor.humidity_bedroom:
expose: true
room: "bedroom"
The two curl commands with return :
pi@raspberrypi:~ $ curl -k -X POST -H "Authorization: Bearer xxxx[...]xxxx" -d '{"state": "154"}' https://xxxxx.duckdns.org/api/states/sensor.temperature_bedroom
{"entity_id": "sensor.temperature_bedroom", "state": "154", "attributes": {}, "last_changed": "2023-04-04T04:50:56.152643+00:00", "last_updated": "2023-04-04T04:50:56.152643+00:00", "context": {"id": "2bd9e7a5be420489fe4d715511c86d08", "parent_id": null, "user_id": "d4e34d3f36c74ea089afb3fe36576baf"}}
pi@raspberrypi:~ $ curl -k -X POST -H "Authorization: Bearer xxxx[...]xxxx" -d '{"state": "15"}' https://xxxxx.duckdns.org/api/states/sensor.temperature_bedroom
{"entity_id": "sensor.temperature_bedroom", "state": "15", "attributes": {}, "last_changed": "2023-04-04T04:51:10.069847+00:00", "last_updated": "2023-04-04T04:51:10.069847+00:00", "context": {"id": "2da659610498171cf7b7d1afe61c94a5", "parent_id": null, "user_id": "d4e34d3f36c74ea089afb3fe36576baf"}}
Is anybody have an idea why this happen please ? I see nothing inside homeassistant log. Can I find any log in google side ?
Add1 : in configuration.yaml file I try to declare “device_class: temperature” of all my sensor inside customize section like I read in some post, but it change nothing :
homeassistant
name: Home
unit_system: metric
customize:
sensor.temperature_bedroom:
device_class: temperature
Add2 : I didn’t notice before, but my humidity sensor doesn’t have the same issue. I can send 2 or more value, google assistant return me the new value each time I ask it (like “ok google what is the humidity inside bedroom ?”)