Closed joostvanmourik closed 5 years ago
This component should handle intents: https://developers.home-assistant.io/docs/en/intent_handling.html
In the meantime you should be able to do it yourself by using conversation/intent scripts: https://www.home-assistant.io/components/conversation/ https://www.home-assistant.io/components/intent_script/
This is also a wish for me. tried to do this with the conversation but with no success
Still on the todo list :-)
For small workarround: use the generic_thermostat in home assistant.
For the built-in Toon component there was an issue regarding the state. This issue is already fixed: https://github.com/home-assistant/home-assistant/pull/18966 4 Will be in the next release i think. Maybe the custom component has the same issue?
I have the same problem, this weekend I installed home assistant and when I ask OK Google whats the temperature. It says the current temperature but also says toon is Off
There is no way to activate it. And if i like to change the temperature for example 18 degrees it says I could not find this, it is not there.
@michel130 create a generic termostat component and sync this with the toon termostat. In the google assistant you can exclude the toon thermostat.
climate:
- platform: toon
name: Toon Thermostaat
host: 192.168.10.13
port: 10080
scan_interval: 8
- platform: generic_thermostat
name: verwarming
heater: switch.power
target_sensor: sensor.toon_temperatuur
min_temp: 13
max_temp: 23
sensor:
- platform: template
sensors:
toon_temperatuur:
friendly_name: "Toon Temeperatuur"
unit_of_measurement: '°C'
value_template: "{{states.climate.toon_thermostaat.attributes.current_temperature}}"
- platform: template
sensors:
toon_temperatuur_gezet:
friendly_name: "Toon Temeperatuur Gezet"
unit_of_measurement: '°C'
value_template: "{{states.climate.toon_thermostaat.attributes.temperature}}"
- platform: template
sensors:
verwarming_temperatuur:
friendly_name: "Verwarming Temeperatuur"
unit_of_measurement: '°C'
value_template: "{{states.climate.verwarming.attributes.current_temperature}}"
- platform: template
sensors:
verwarming_temperatuur_gezet:
friendly_name: "Verwarming Temeperatuur Gezet"
unit_of_measurement: '°C'
value_template: "{{states.climate.verwarming.attributes.temperature}}"
automation:
- trigger:
platform: homeassistant
# Event can also be 'shutdown'
event: start
action:
- service: climate.set_temperature
data_template:
entity_id: climate.verwarming
temperature: "{{states.sensor.toon_temperatuur_gezet.state}}"
- trigger:
platform: state
entity_id: sensor.toon_temperatuur_gezet
condition:
condition: template
value_template: "{{ state_attr('climate.toon_thermostaat', 'temperature') != state_attr('climate.verwarming', 'temperature') }}"
action:
- service: climate.set_temperature
data_template:
entity_id: climate.verwarming
temperature: "{{states.sensor.toon_temperatuur_gezet.state}}"
- trigger:
platform: state
entity_id: sensor.verwarming_temperatuur_gezet
condition:
condition: template
value_template: "{{ state_attr('climate.toon_thermostaat', 'temperature') != state_attr('climate.verwarming', 'temperature') }}"
action:
- service: climate.set_temperature
data_template:
entity_id: climate.toon_thermostaat
temperature: "{{states.sensor.verwarming_temperatuur_gezet.state}}"
and in the google assistant config:
climate.toon_thermostaat:
expose: false
Great stuff. I was trying to see if the original toon component fixes which were done lately -and were referred too in this post- fixed it for my custom component, but didn't get it to improve, still not sure what google misses, Will try above, and also try to fix the custom component with this info.
@Webserve thanks for your nice instruction.
I am only stuck with one thing:
I add climate - sensor - automation in the following file: configuration.yaml
But when I add this in the configuration.yaml under my google assistant climate.toon_thermostaat: expose: false
I received an error. Do I also need to delete the files what I download from this site?
https://www.home-assistant.io/components/google_assistant/ <-
I dont know the error. But read the docs. Also you can try to expose both to google assistant and see if thats working.
@cyberjunky did you get it working? I could say hey google set temperature on 20 degrees, it says okay I will set Toon on 20 degrees but on Toon nothing has changed, but when I check the Home Assistant I see that it did but not on Toon.
When I used your toon.py and change it manual in the Home Assistant it changed also on Toon, only not the one from Webserve.
In this case yours can do manual in Home Assistant but not wit google home. The one from Webserve is working with google home, but does not change it on Toon self.
Thanks,
Regards, Michel
I have the temperature change function working now in a very rough version of toon.py. Still need to work on the modes, will try to get this working tomorrow.
Wow great work. IF you need somebody to test i'am free this evening :-)
@cyberjunky nice work, if you want I also can also test it.. :
I have the temperature change function working now in a very rough version of toon.py. Still need to work on the modes, will try to get this working tomorrow.
Any Progress ?
Not really.. Google assistant only supports a few modes. I guess operation mode will be pinned to heating. And we can only toggle program on off. Working with commands that are completely different than the modes of toon is not logical. I'm trying to combine this with the correct commands displayed in gui like we had without google ass. Support. Toon is simply not a normal climate device with on off heat cool
Not really.. Google assistant only supports a few modes. I guess operation mode will be pinned to heating. And we can only toggle program on off. Working with commands that are completely different than the modes of toon is not logical. I'm trying to combine this with the correct commands displayed in gui like we had without google ass. Support. Toon is simply not a normal climate device with on off heat cool
If we can set program on/of and it goes back to the latest programmed mode would be usable for me.
Yes thats want i want to achieve. It took some time to figure out how other climate devices do this. But their commands fit better.. And i discovered that after i defined min and max temp inside the component you can ask google to set the themostat higher or lower.. It will add/substract 5c of current set temp.
Any chance that you upload the last version of your component? I don't actually need the programs on Toon, I use Home Assistant to set the temperature, based on some automations. Would be 'cool' to talk to my GH and let it set the temperature to a certain degree though.
The same here, I only want to ask to google home, what is the temperature in the house, and than say okay google set temperature on for example 22 degrees .
Sounds like great progress! Will it be possible to define the on and off states to one of the operation modes from Toon in the configuration.yaml/customize.yaml? Or should does it need to be some fixed values?
Something like
climate:
- platform: toon name: Toon Thermostaat
host: 192.168.10.99
port: 10080
scan_interval: 7
on_preset: 0 # 0=Comfort. If not defined, defaults to 1 (Home)
off_preset: 4 # 4=Holiday. If not defined, defaults to 3 (Away)
@cyberjunky
Hello Ron,
Could you please share yours toon.py file? So I can put it in my home assistant. Till now, I don't get it fixed. I only could say what is the temperature and it says..
For now I am using domoticz, and with domoticz I connect with ifftt to set the temperature but I want to have it in homeassistant.
Regards, Michel
Attached a kind of working version with the modes from the original toon component. You can ask and set temperature, and put toon in one of the following modes as shown here: https://www.home-assistant.io/components/climate.toon/ Not sure what the Dutch word for performance should be. toon.zip
What I still wonder (maybe someone can find out) if Google Assistant still supports 'comfort settings'. Since these should be the ones to use with toon, like with ecobee here. Didn't look at Home Assistant support for them either. https://support.ecobee.com/hc/en-us/articles/115002735571-What-commands-can-I-use-with-the-Google-Assistant- Hold modes are supported inside climate components.
The comfort settings still seems to exists in Google Assistant, just not yet on Home Assistant https://developers.google.com/actions/reference/smarthome/traits/modes https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/google_assistant/trait.py
@cyberjunky
Hello,
Thanks for the file, but I don't get it, I replace toon.py in custom_components/climate and after an reboot of homeassistant I don't see any climate in homeassistant.
When I replace the file with the old one and reboot the homeassistant I see the climate back in homeassistant.
This is what I only add in configuration.yaml
climate:
Is there something else what I need to do?
Do I still need to add the lines from Webserve ?
Thanks
Regards, Michel
No my config is a workarround.
Did you also delete the pycache dir?
Else check the logging.
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 56, in async_setup_component
return await task # type: ignore
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 118, in _async_setup_component
conf_util.async_process_component_config(hass, config, domain)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/config.py", line 760, in async_process_component_config
platform = get_platform(hass, domain, p_name)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 60, in get_platform
return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 92, in get_component
module = importlib.import_module(path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 669, in exec_module
File "<frozen importlib._bootstrap_external>", line 775, in get_code
File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/homeassistant/.homeassistant/custom_components/climate/toon.py", line 152
return [state_mapping[k] for k in self._operation_list]
^
SyntaxError: 'return' outside function
2018-12-16 20:03:38 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 21.68s
2018-12-16 20:03:38 INFO (MainThread) [homeassistant.core] Starting Home Assistant
It had some errors. I replaced the toon.zip file with a working one.
Attached a kind of working version with the modes from the original toon component. You can ask and set temperature, and put toon in one of the following modes as shown here: https://www.home-assistant.io/components/climate.toon/ Not sure what the Dutch word for performance should be. toon.zip
Could you also do version with all the current dutch modes, so you will only be able to change the actual temperature witth Google Asssistant. Or are we still be able to built in extra mode to return to the scheduled probgram on Toon ?
Am i doing something wrong ? I Only can use modes Eco, and Heat. Also i'am not able to set the temperature. "Toon thermostat kan niet worden ingesteld op 20 graden" I'am trying to use it in dutch
Come on, I made clear that I was working on that, and the code wasn't finished, but you kept asking for the code, so I gave it. It's doesn't seem easy to combine toon's and google assistant modes, as soon as you do that google assistant stops working. I think the only way to implement most of them is via the hold_mode aka comforst settings, but that needs a special climate gui component I thinkl.
Come on, I made clear that I was working on that, and the code wasn't finished, but you kept asking for the code, so I gave it. It's doesn't seem easy to combine toon's and google assistant modes, as soon as you do that google assistant stops working. I think the only way to implement most of them is via the hold_mode aka comforst settings, but that needs a special climate gui component I thinkl.
Sorry thought the modes where finisched no problem there, just testing. Chaning the temperature doesn't work. Sometimes it does but only 1 of the 5 times
I have no problem, it works 👌. It changed everything with one commando. Very nice job
I have no problem, it works 👌. It changed everything with one commando. Very nice job
Wich commando do you use exactly ?
Alleen 'Performance' (Comfort) heb ik nog niet gevonden ;-)
I say hey google: set heater on 22 degrees and it go's on 22 degrees, I say hey google set heater on 17 degrees and it goes on 17 degrees.
@cyberjunky
Maybe you have someting from my info Domoticz:
Toon Scenes
Off http://ToonIP/happ_thermstat?action=setSetpoint&Setpoint=60
Away http://ToonIP/happ_thermstat?action=changeSchemeState&state=2&temperatureState=3
Sleep http://ToonIP/happ_thermstat?action=changeSchemeState&state=2&temperatureState=2
Home http://ToonIP/happ_thermstat?action=changeSchemeState&state=2&temperatureState=1
Comfort http://ToonIP/happ_thermstat?action=changeSchemeState&state=2&temperatureState=0
Manual no line in use
Toon Auto Program http://ToonIP/happ_thermstat?action=changeSchemeState&state=0 http://ToonIP/happ_thermstat?action=changeSchemeState&state=1
This is how my domoticz scrip looks like, this scrip works okay, maybe you found something that you can use:
return { on = { timer = { 'every minute' } }, execute = function(domoticz) local ToonThermostatSensorName = domoticz.variables('UV_ToonThermostatSensorName').value -- Sensor showing current setpoint local ToonTemperatureSensorName = domoticz.variables('UV_ToonTemperatureSensorName').value -- Sensor showing current room temperature local ToonScenesSensorName = domoticz.variables('UV_ToonScenesSensorName').value -- Sensor showing current program local ToonAutoProgramSensorName = domoticz.variables('UV_ToonAutoProgramSensorName').value -- Sensor showing current auto program status local ToonProgramInformationSensorName = domoticz.variables('UV_ToonProgramInformationSensorName').value -- Sensor showing displaying program information status local ToonIP = domoticz.variables('UV_ToonIP').value local DomoticzIP = domoticz.variables('UV_DomoticzIP').value
-- Handle json
--local json = assert(loadfile "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\json.lua")() -- For Windows
-- local json = assert(loadfile "/home/maes/domoticz/scripts/lua/JSON.lua")() -- For Linux
json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")() -- For Raspberry
handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
local ThermostatInfo = handle:read('*all')
handle:close()
local jsonThermostatInfo = json:decode(ThermostatInfo)
if jsonThermostatInfo == nil then
return
end
local currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
local currentProgramState = tonumber(jsonThermostatInfo.programState)
if currentProgramState == 0 then currentProgramState = 10 -- No
elseif currentProgramState == 1 then currentProgramState = 20 -- Yes
elseif currentProgramState == 2 then currentProgramState = 30 -- Temporary
end
local currentActiveState = tonumber(jsonThermostatInfo.activeState)
if currentActiveState == -1 then currentActiveState = 50 -- Manual
elseif currentActiveState == 0 then currentActiveState = 40 -- Comfort
elseif currentActiveState == 1 then currentActiveState = 30 -- Home
elseif currentActiveState == 2 then currentActiveState = 20 -- Sleep
elseif currentActiveState == 3 then currentActiveState = 10 -- Away
end
local currentNextTime = jsonThermostatInfo.nextTime
local currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
local currentBoiletSetPoint = jsonThermostatInfo.currentInternalBoilerSetpoint
----
-- Update the thermostat sensor to current setpoint
if domoticz.devices(ToonThermostatSensorName).setPoint*100 ~= currentSetpoint*100 then
domoticz.log('Updating thermostat sensor to new set point: ' ..currentSetpoint)
domoticz.devices(ToonThermostatSensorName).updateSetPoint(currentSetpoint).silent()
end
-- Update the temperature sensor to current room temperature
if domoticz.round(domoticz.devices(ToonTemperatureSensorName).temperature, 1) ~= domoticz.round(currentTemperature, 1) then
domoticz.log('Updating the temperature sensor to new value: ' ..currentTemperature)
domoticz.devices(ToonTemperatureSensorName).updateTemperature(currentTemperature)
end
-- Update the toon scene selector sensor to current program state
if domoticz.devices(ToonScenesSensorName).level ~= currentActiveState then -- Update toon selector if it has changed
domoticz.log('Updating Toon Scenes selector to: '..currentActiveState)
domoticz.devices(ToonScenesSensorName).switchSelector(currentActiveState).silent()
end
-- Updates the toon auto program switch
if domoticz.devices(ToonAutoProgramSensorName).level ~= currentProgramState then -- Update toon auto program selector if it has changed
domoticz.log('Updating Toon Auto Program selector to: '..currentProgramState)
domoticz.devices(ToonAutoProgramSensorName).switchSelector(currentProgramState).silent()
end
-- Updates the toon program information text box
if currentNextTime == 0 or currentNextSetPoint == 0 then
ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
else
ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
end
if domoticz.devices(ToonProgramInformationSensorName).text ~= ToonProgramInformationSensorValue then
domoticz.log('Updating Toon Program Information to: '..ToonProgramInformationSensorValue)
domoticz.devices(ToonProgramInformationSensorName).updateText(ToonProgramInformationSensorValue)
end
end
}
Alleen 'Performance' (Comfort) heb ik nog niet gevonden ;-)
I was asking "Zet de temperatuur op 20 graden" should be "zet de thermostaat op 20 graden" that seems to work.
Just one question left. Do you think it would be possible to add this: https://github.com/cyberjunky/home-assistant-custom-components/issues/8 to your version ?
No need to let this work in Google Assistance, just for Home Assistant i use it when i return home to put Toon back to te current programmed mode. When i leave home i put it on "away".
Thanx for all your help sofar.
Alleen 'Performance' (Comfort) heb ik nog niet gevonden ;-)
"Zet Toon op Auto" seems to work
Alleen 'Performance' (Comfort) heb ik nog niet gevonden ;-)
"Zet Toon op Auto" seems to work
Mmm... was testing it for a while but it only functions like 5 out of the 10 times. If you leave it for 5 minutes and try to set the temperature it doesn't work then change mode to eco and try again it works. But 2 minutes later it doesn't :-)
Why did you close this issue? There is no official update on the master branche.
Thanks for the update @michel130 I will test. Hopeful I can delete the generic thermostat :-)
(Engels schrijven op een forum waar naar mijn idee alleen nederlanders zitten :-) )
Sorry had no intention to close this case :-) For me it works sometimes but moest of the time Google Says Toon can't do it
It works only if it on a program and you say okay google set temperature on ... but after that it does not work, only if you switch back to home or someting like that.
I was also see if I could fix that problem, that is why I add the scrip from my domoticz that works but if I want to use google home I need controlicz .
@Webserve idd (Engels schrijven op een forum waar naar mijn idee alleen nederlanders zitten :-) )
Ik denk zeker met dit klein probleempje, opzicht werkt het wel wat joostvanmourik zegt maar niet altijd.
Klopt inderdaad, ben er echter nog niet helemaal achter wanneer het wel / niet werkt, kan nooit random zijn maar heb de juiste volgorde ook nog niet helemaal ontdekt. Hopelijk kan dat er nog uit dan werkt het mooi en dat zonder Eneco Abbo
Ik gebruik de generic variant hier voorlopig naar alle tevredenheid.
Op ma 24 dec. 2018 om 12:09 schreef joostvanmourik <notifications@github.com
:
Klopt inderdaad, ben er echter nog niet helemaal achter wanneer het wel / niet werkt, kan nooit random zijn maar heb de juiste volgorde ook nog niet helemaal ontdekt. Hopelijk kan dat er nog uit dan werkt het mooi en dat zonder Eneco Abbo
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cyberjunky/home-assistant-custom-components/issues/13#issuecomment-449720396, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgFx246uXJsarv1WUktplbxf8QVi2IVks5u8LYGgaJpZM4YLm5F .
De generic variant werkte bij mij niet, ik had alles gedaan van Webserve, die van cyberjunky werkt wel.
Alleen als je 1 maal iets hebt gezegd, en je wilt terug of hoger dan werkt dat niet altijd, dit komt denk ik door de standen slapen, comfort, thuis, weg.
Ik heb die op een timer staan dat die om 23 uur altijd op slapen gaat en om 7 uur op thuis.
Comfort doe ik als het echt fris wordt, maar als ik zeg verwarming 22 graden, en later terug op 19 dan doet die dat niet.
De generic variant werkte bij mij niet, ik had alles gedaan van Webserve, die van cyberjunky werkt wel.
Alleen als je 1 maal iets hebt gezegd, en je wilt terug of hoger dan werkt dat niet altijd, dit komt denk ik door de standen slapen, comfort, thuis, weg.
Ik heb die op een timer staan dat die om 23 uur altijd op slapen gaat en om 7 uur op thuis.
Comfort doe ik als het echt fris wordt, maar als ik zeg verwarming 22 graden, en later terug op 19 dan doet die dat niet.
Inderdaad bij mij ook. Als ik hem op 21 graden zet, dan kan ik daarna niets meer. Overigens is hij dan ook grijs in de google home app. Als ik hem dan op de Toon zelf weer terug zet op een stand dan word hij ook weer bereikbaar via Google Home App en dus ook voor de Google Assistent.
Geen idee of die generic thermostat zou kunnen werken heb ik nog niet geprobeerd. Voorlopig doet hij het aardig. Ik zou alleen de "ProgramOn" stand nog graag geïntegreerd zien in deze versie. Ik kan dan bij thuiskomst tegen toon zeggen dat ik wil dat hij terug gaat naar de laatst geprogrammeerde stand. Zie https://github.com/cyberjunky/home-assistant-custom-components/issues/8.
Zou fijn zijn als we dit consequent werkend kunnen krijgen. Heb het idee dat we (nouja @cyberjunky) er bijna is.
Change STATE_AUTO to STATE_HEAT and STATE_AWAY to STATE_ECO to conform to climate DOMAIN standards. Change made to fix Alexa/Google Assistant support for this component. (@marchingphoenix - #19242) (climate.eq3btsmart docs) (breaking change)
New on 0.85
Should it be possible to use Toon with the Google Assistant. If i ask OK Google whats the temperature. It says the current temperature but also says toon is Off
There is no way to activate it. And if i like to change te temperature it seems not to recognize the command.
Any idea ?