Cześć,
jak oczytać i jak wysłać dane do termostatu w HA? Jedyne co potrafię przeczytać o stan (grzeje / wyłączony). Potrzebuje wysłać zmianę temperatury.
@pawell32 możesz to jakoś bardziej sprecyzować ? Samo wysłanie polecenia do termostatu np generic thermostat to prosty zapis
@isom tak, chodzi takie polecenie. Chcąc usatawić kilka wariantów muszę na schemacie ustawić tyleż samo bloków call service, bardziej szukam rozwiązania by tę wartość uwarunkować od zmiennej.
tu mi nie działało, ponieważ stawiałem kropkę pomiędzy temperature a wartością 🙂
Jak to działa , to połowa sukcesu 😉
W polu Data ,zamiast konkretnej wartości wstawiasz coś w ten deseń:
{"temperature":"{{payload}}"}
I wysyłasz do tego noda call service różne wartości , a on to odczytuje w wiadomości.
@marcingajda ok, niestety nie wiem w jakim formacie to wysłać. Ustawiam "switch" a w nim różne wartości, ale call service nie odczytuje tego. Jeśli to ma być m. payload to string i wartość. Wstawiałęm też pełną wartość i nic.
Choćby takie coś powinno to ustawić ( zaimportuj to do nodered i połącz z tym Twoim call service , i zobacz czy ustawi , jak tak , to w debugu będziesz widział , jak ma wyglądać wiadomość 🙂 ):
[{"id":"672c153581dfa5fe","type":"inject","z":"067d38891fbe94ad","name":"SetTemp","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"5","topic":"","payload":"23.5","payloadType":"num","x":420,"y":180,"wires":[["fa1f8576985691d2"]]},{"id":"fa1f8576985691d2","type":"debug","z":"067d38891fbe94ad","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":260,"wires":[]}]
@marcingajda możesz jaśniej? Z tego co widzę to jest "inject", a jak potrzebuję do np. "change".
To co podałeś nie wiem gdzie mam to wkleić, nie znam na tyle jeszcze NR.
Tak , to jest inject , i "wstrzyknie" Ci podaną w niej wartość 23.5 to noda call service , jak go z nim połączysz.
A jak wstrzykniesz i się to ustawi , to w debugu zobaczysz ,jak powinna wyglądać wiadomość , którą aktualnie przyjmuje nod call serwice.
Możesz też debuga podpiąć pod wyjście noda , którym podajesz wartości do tego call service , i ją pokazać , to dostosuje się to co ma być w polu data.
@marcingajda tak to rozumie, zwraca mi:
Call-service error. expected float for dictionary value @ data['temperature']
Ale chyba debuga wstawiłeś za ten call-service , wstaw go przed i zobacz jaką wiadomość on dostaje.
@marcingajda wpierw mi powiedz jak mam utworzyć noda wg twojego wiersza
W menu ( ikonka z trzema paskami w prawym gornym rogu) znajdujesz import , lub naciskasz ctrl+i , i wklejasz całą linijkę , co ja wyeksportowałem 🙂
@mig41 🙂
16.12.2022, 09:31:52node: debug 1msg.payload : number 23.5 16.12.2022, 09:31:52salonsent data : msg : { domain: "climate", service: "set_temperature", data: object }
No i ustawiła się temperatura 23.5 ?
W sensie ,w HA była inna , a po wysłaniu w node red tym injectem zmianiła się na tą ?
@mig41 no nie, cały czas mam błąd.
[{"id":"fc36258053a5e684","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"3b2d2fea6718cf1c","type":"api-call-service","z":"fc36258053a5e684","name":"salon","server":"3d7533d10bf6d654","version":5,"debugenabled":true,"domain":"climate","service":"set_temperature","areaId":[],"deviceId":[],"entityId":["climate.thermo_salon"],"data":"{\"temperature\":\"{{payload}}\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":120,"wires":[[]]},{"id":"672c153581dfa5fe","type":"inject","z":"fc36258053a5e684","name":"SetTemp","props":[{"p":"topic","v":"24","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":"5","topic":"","x":200,"y":280,"wires":[["fa1f8576985691d2","3b2d2fea6718cf1c"]]},{"id":"fa1f8576985691d2","type":"debug","z":"fc36258053a5e684","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":480,"y":320,"wires":[]},{"id":"3d7533d10bf6d654","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]
Wiesz ,ze w tym iniect zmieniłeś typ msg.payload na msg.topic ?
@mig41 tak, wiem. sprawdzałem inne funkcje, które akurat działają. nie mogę tylko wywołać zmiany temperatury.
Muszę to później potestować , bo już czasu brak .
Wrzuć jak ustawiłeś cały ten climate , to u siebie stworzę identyczny
termostat:
- platform: generic_thermostat name: thermo salon heater: switch.zawor1 target_sensor: sensor.zigbee_salon_temperature min_temp: 15 max_temp: 25 ac_mode: false target_temp: 21 cold_tolerance: 0.3 hot_tolerance: 0.3 min_cycle_duration: minutes: 1 keep_alive: minutes: 3 initial_hvac_mode: "heat" precision: 0.1
flow:
[{"id":"fc36258053a5e684","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"3b2d2fea6718cf1c","type":"api-call-service","z":"fc36258053a5e684","name":"salon","server":"3d7533d10bf6d654","version":5,"debugenabled":true,"domain":"climate","service":"set_temperature","areaId":[],"deviceId":[],"entityId":["climate.thermo_salon"],"data":"{\"temperature\":\"{{palyload}}\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":120,"wires":[[]]},{"id":"fa1f8576985691d2","type":"debug","z":"fc36258053a5e684","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":200,"wires":[]},{"id":"d86286b9b0f370e2","type":"inject","z":"fc36258053a5e684","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"23","payloadType":"num","x":190,"y":200,"wires":[["3b2d2fea6718cf1c","fa1f8576985691d2"]]},{"id":"3d7533d10bf6d654","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]
Ok , takie coś działa
[{"id":"3b2d2fea6718cf1c","type":"api-call-service","z":"fc36258053a5e684","name":"salon","server":"3d7533d10bf6d654","version":5,"debugenabled":true,"domain":"climate","service":"set_temperature","areaId":[],"deviceId":[],"entityId":["climate.thermo_salon"],"data":"{\"temperature\":\"{{payload}}\",\"entity_id\":\"climate.thermo_salon\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":120,"wires":[[]]},{"id":"672c153581dfa5fe","type":"inject","z":"fc36258053a5e684","name":"SetTemp","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"5","topic":"","payload":"22.5","payloadType":"str","x":200,"y":280,"wires":[["fa1f8576985691d2","3b2d2fea6718cf1c"]]},{"id":"fa1f8576985691d2","type":"debug","z":"fc36258053a5e684","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":480,"y":320,"wires":[]},{"id":"3d7533d10bf6d654","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]