Closed ghost closed 7 years ago
At some point I would like to write an API, but I don't have time at the moment. I haven't worked with Home Assistant before, but if you can write custom HTML GET/POST messages, you can use the ThermOS web backend to control everything and get the data that you want.
If you take a look at thermostat_web.py, any definition that has @app.route(urlpath, methods=['POST'])
above it is a worker function. You can post a form to that url path to do things such as set the temperature or edit a schedule entry.
Any definition that is preceded by @app.route(urlpath, methods=['GET'])
is a function that will return data.
you got an example on how to do a post example would be nice for turning fan from on to auto and system from auto to cool and heat
thnx
I am also trying to extract data and push data to server from a remote endpoint.. Any suggestions of where to start would be helpfull. Your work is awesome and works well locally.
I'm pretty busy right now, but I'll try to get you guys some examples this evening
So here's just a quick post method with a python script:
import requests
url="http://localhost/hold"
data= {
'onoffswitch':'on', #on=Cool, #off=Heat
'target': u'75', #Target Temp
'timeFrame': u'.25' #time in hours
}
requests.post(url, data=data)
In this example, you first import the requests module. 2) you set the url (Note the '/hold' at the end), in my case, I was testing on the same machine that ThermOS was running. Otherwise, replace localhost with your Thermostat local IP 3) data that you want to send. Since we are sending data to the 'hold' function, there is specific names that must be used 4) post the request and the Thermostat will handle the rest
It will be up to you to figure out how to implement it into homeAssistant though as I'm not familiar with their API. I'll post some references for you to access other functions when I get a chance.
We figured it out now the whole thermostat is controllable from homeassistant
homeassistant: customize: sensor.fan_mode: friendly_name: Fan haaska_hidden: true icon: mdi:fan
sensor.system_mode:
friendly_name: Mode
haaska_hidden: true
icon: mdi:settings
sensor.indoor_temperature:
friendly_name: Indoor Temp
haaska_hidden: true
icon: mdi:thermometer-lines
sensor.operation_set_point:
friendly_name: Setpoint
haaska_hidden: true
icon: mdi:oil-temperature
sensor.fan_on:
friendly_name: Fan Status
haaska_hidden: true
icon: mdi:fan
sensor.operation_mode:
friendly_name: Operation Mode
haaska_hidden: true
icon: mdi:air-conditioner
group: thermos: name: thermos entities:
input_select: heat_cool: name: Heat Cool options:
OFF initial: COOL
temp: options:
automation:
alias: "Change Thermostat" trigger:
alias: "Change input select of temp if Thermostat is changed manully" trigger:
alias: "Change input select of mode if Thermostat is changed manully" trigger:
script: run: sequence:
shell_command: heat_cool_select: curl -d "mode={{ states.input_select.heat_cool.state }}&target={{ states.input_select.temp.state }}" -X POST http://73.54.53.122:8880/system
sensor:
platform: scrape resource: http://10.1.10.183/_liveUpdate select: '#fanModeContainer' name: Fan Mode icon: mdi:fan
platform: scrape resource: http://10.1.10.183/_liveUpdate select: '#systemModeContainer' name: System Mode icon: mdi:nest-thermostat
platform: scrape resource: http://10.1.10.183/_liveUpdate select: '#indoorTempContainer' name: Indoor Temperature icon: mdi:thermometer unit_of_measurement: °F
platform: scrape resource: http://10.1.10.183/info select: '#cool' name: Operation Cool
platform: scrape resource: http://10.1.10.183/info select: '#heat' name: Operation Heat
platform: scrape resource: http://10.1.10.183/info select: '#fan' name: Operation Fan
platform: scrape resource: http://10.1.10.183/_liveUpdate select: '#targetTemps' name: Operation Set Point unit_of_measurement: °F
platform: template sensors: fan_on: friendly_name: "Fan Running" value_template: "{{ 'ON' if 'ON' in states.sensor.operation_fan.state | upper else 'OFF' }}"
platform: template sensors: operation_mode: friendly_name: "Operation Mode" value_template: >- {% if states.sensor.operation_cool.state.split(':')[1] |trim | upper == 'ON' %} COOL {% elif states.sensor.operation_heat.state.split(':')[1] |trim | upper == 'ON' %} HEAT {% else %} OFF {% endif %}
IMPORTANT: This email is intended for the use of the individual addressee(s) named above and may contain information that is confidential, privileged or unsuitable for overly sensitive persons with low self-esteem, no sense of humour or irrational religious beliefs. If you are not the intended recipient, any dissemination, distribution or copying of this email is not authorised (either explicitly or implicitly) and constitutes an irritating social faux pas. Unless the word absquatulation has been used in its correct context somewhere other than in this warning, it does not have any legal or grammatical use and may be ignored. No animals were harmed in the transmission of this email, although the yorkshire terrier next door is living on borrowed time, let me tell you. Those of you with an overwhelming fear of the unknown will be gratified to learn that there is no hidden message revealed by reading this warning backwards, so just ignore that Alert Notice from Microsoft: However, by pouring a complete circle of salt around yourself and your computer you can ensure that no harm befalls you and your pets. If you have received this email in error, please add some nutmeg and egg whites and place it in a warm oven for 40 minutes. Whisk briefly and let it stand for 2 hours before icing.
Legal Notice: Receipt of this message constitutes your unconditional acceptance of agreement with all terms, conditions, conclusions and opinions, either expressed or implied, as interpreted by the author without further clarification. Use of any information contained herein [inclusive of any and all attachments] or omitted in part or in whole from the actual message is strictly prohibited and will be subject to collection of significant financial damages.
The views of my employer do not conform to my views, or to any accepted standard of logic that the Greeks thought up anyway...
None of the ideas expressed above are actually mine. They are told to me by Luthor and Ferdinand, the five inch tall space aliens who live under my desk. In return for these ideas, I have given them permission to eat any dust bunnies they may find under there.
No trees were destroyed in the sending of this message, however, a significant number of electrons were terribly inconvenienced.
On Tue, Oct 17, 2017 at 1:14 PM, mholgatem notifications@github.com wrote:
So here's just a quick post method with a python script:
import requests url="http://localhost/hold" data= { 'onoffswitch':'on', #on=Cool, #off=Heat 'target': u'75', #Target Temp 'timeFrame': u'.25' #time in hours } requests.post(url, data=data)
In this example, you first import the requests module. 2) you set the url (Note the '/hold' at the end), in my case, I was testing on the same machine that ThermOS was running. Otherwise, replace localhost with your Thermostat local IP 3) data that you want to send. Since we are sending data to the 'hold' function, there is specific names that must be used 4) post the request and the Thermostat will handle the rest
It will be up to you to figure out how to implement it into homeAssistant though as I'm not familiar with their API. I'll post some references for you to access other functions when I get a chance.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mholgatem/ThermOS/issues/8#issuecomment-337290077, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQ8mOsa3YUacC1RPGTUu3SPIfHvgkQDks5stOB6gaJpZM4Pxye_ .
wow, very cool! Is this all that is required or are there additional scripts that go with this to operate it?
that is all thats required and we can set cool heat off we can set temps and it shows all modes
i run it on a 5 inch touchscreen ppl are getting interested now in it since total cost to make the whole thing is about 60-70$
On Oct 19, 2017 7:37 PM, "mholgatem" notifications@github.com wrote:
wow, very cool! Is this all that is required or are there additional scripts that go with this to operate it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mholgatem/ThermOS/issues/8#issuecomment-338066763, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQ8mKqWF7UUX-iWSJf3ufV-bRGaYUBzks5st90hgaJpZM4Pxye_ .
https://photos.app.goo.gl/OT74t3n6PFoixyxM2
On Oct 19, 2017 7:37 PM, "mholgatem" notifications@github.com wrote:
wow, very cool! Is this all that is required or are there additional scripts that go with this to operate it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mholgatem/ThermOS/issues/8#issuecomment-338066763, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQ8mKqWF7UUX-iWSJf3ufV-bRGaYUBzks5st90hgaJpZM4Pxye_ .
https://photos.app.goo.gl/wyprCgSj4T3NglqG2
On Oct 19, 2017 7:37 PM, "mholgatem" notifications@github.com wrote:
wow, very cool! Is this all that is required or are there additional scripts that go with this to operate it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mholgatem/ThermOS/issues/8#issuecomment-338066763, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQ8mKqWF7UUX-iWSJf3ufV-bRGaYUBzks5st90hgaJpZM4Pxye_ .
ah, ok. I see your shell command now. Very nice! I'm going to re-open this issue, so that I remember it. When I have some time, I'll build it into the project (if you don't mind). BTW, how did you come across this project?
well there was not really a good thermostat thats DIY so i spend a couple hours googeling and yours was the best one so i made one . then i needed remote control so me and a friend spend a coupke days integrating it to homeassistant. now we got someone else working on a rest api and mqtt for it so we can use the hvac module homeassistant has.
On Oct 19, 2017 8:03 PM, "mholgatem" notifications@github.com wrote:
ah, ok. I see your shell command now. Very nice! I'm going to re-open this issue, so that I remember it. When I have some time, I'll build it into the project (if you don't mind). BTW, how did you come across this project?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mholgatem/ThermOS/issues/8#issuecomment-338070464, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQ8mC3ZYoS4DqZeol1Qg_HJFcBFkSmDks5st-M1gaJpZM4Pxye_ .
very cool. If you guys are familiar with github, you are always welcome to create a pull request. I'm always eager to have help on these projects.
yeah we will once we got rest and mqtt working this thermostat is going places quick now we will have a writeup on our homeassistant project and module page soon .... the guy thats supposed to write it is looking after his wife atm in the hospital she had surgery yesterday so itll be a couple days
On Oct 19, 2017 8:17 PM, "mholgatem" notifications@github.com wrote:
very cool. If you guys are familiar with github, you are always welcome to create a pull request. I'm always eager to have help on these projects.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mholgatem/ThermOS/issues/8#issuecomment-338072419, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQ8mPfzfh7vMc5KSt38Duf_03yizcjQks5st-atgaJpZM4Pxye_ .
Good Morning mholgatem
I am the guy that got nominated to write this up... LOL ... I am open to anyway to write it up... At first a had a fork and was going to add a file of the homeassistant thermo.yaml (package) config and a readme with pics and discriptions of the wiring and formatting of the touchscreen. I am new to git and was worried that it could take credit away from you... Any suggestions... My plan was a git for Homeassitant DIY thermo powered by mholgatem? I didnt know if having your software on the git would be best or a link.. I dont like links it has users digging around and getting lost.
and also would this fork update from changes on your end.. I think the Home Assistant option you give you more exposure
I don't really care much about credit, I just like to see how people use my code. But what I was thinking is that we can make an installer for the Home Assistant stuff. As far as I am aware, the config yaml files just need to be copied into the correct Home Assistant folder, right? We could do a thing like this:
Install ThermOS → Check for Home Assistant installation → if no Home Assistant, ask if you'd like to install Home Assistant → Copy thermo.yaml to correct Home Assistant folder Then ask if this will be run with a touch screen or in headless mode
If you want to figure out the config stuff, you can either send it to me via email (holgate.mark1@gmail.com) or you can create a pull request by clicking 'create new pull request' on the code page.
yes but the home assistant install is not quite that easy.. The yaml for the thermos would have to have the correct ip of the thermos and you would need to secure home assistant with ssl and a dyndns..and config a password... Let me think... I think zombu would know a little better than I since All i did is the homeassistant config for him
setting the correct ip is easy, I have lots of bash scripts that do that sort of thing. I would set up the home assistant to be local network only, so that the ssl/dyndns/password stuff can be skipped. My thinking is that if they want it public facing, then they can do the legwork to set that stuff up. I personally discourage setting up public facing hardware unless you are working on your own project or are making enough money doing it to cover legal fees. All that it takes is one litigious person to tie up all of your assets defending yourself in court.
Zombu is trying to use a tinkerboard that has more horsepower for the ha install.... will post when that happens
cool. let me know.
Are you guys running the thermostat on a separate board from the home assistant?
We are trying to give user a option for either way... a installer that will give option of home assistant installed or not ..... I have started the write up but its still alpha https://github.com/Vasiley/Diy_Thermostat_with_Homeassistant
Cool.... Once I get all info will try that Thanks Just learning all this LOL
yeah, it's a lot to take in all at once. let me know if you have any questions.
Hi there is there any way to get to an api so it could be integrated into homeassistant? i don't seem to be able to find anything about it
would be nice to be able to remotely change and monitor temps and maybe change fan and heat/cool
thnx