Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermostat Schedule, Fan, and Equipment #5

Open
b0tt0mturn opened this issue Feb 2, 2024 · 33 comments
Open

Thermostat Schedule, Fan, and Equipment #5

b0tt0mturn opened this issue Feb 2, 2024 · 33 comments

Comments

@b0tt0mturn
Copy link

First off, thanks so much for this. I've got an HVAC imbalance in my home and I've been using your server code and HA to run the fan at various levels depending on temperature delta to equalize rooms temperatures - it's made a huge difference. So far it's been completely stable.

Here is a list of things that have been minor issues for me:

  1. The Schedule on the Observer gets reset within 12 hours. The Observer Wake, Home, Evening, Sleep settings get set to 69 or 71 degrees and the schedule is also reset to some default - I can't for the life of me figure out how or why. I can set automations in HA to hold temperature during certain time triggers, but that is not as family friendly as setting the schedule on the Observer.

  2. The Observer has high, med and low fan settings, but the Thermostat entity only has high and low - can the medium setting be added?

  3. Finally, it would be nice to know how often and how long the heat, aux heat (its a heat pump) and cool run for. I assume that is the Active Equipment Event, but that seems to be broken.

Thanks again for all your work on this.

@aneisch
Copy link
Owner

aneisch commented Feb 2, 2024

  1. I suspect this might be due to the response we send the thermostat when it asks for the config. I'll look into how we might read in the current program on first connect, and then spit that back out instead of responding with a "blank" one. I run my thermostat in Hold mode, so this has never come up as an issue for me.

I see a bug here also where 71 is set in place of {candidate_configuration["htsp"]} in (fixed b8bc435). Does this fix the issue for you?

301946155-5d54cbfc-b588-4b93-bfa3-f134acc3840a

  1. Added in 362ff77. Thanks for pointing this out!

  2. Active equipment events are things like failures or faults. Things you don't want to see, such as when the capacitor in my outdoor unit failed in the middle of summer:
    Screen Shot 2024-02-02 at 1 14 40 PM

I use a history_stats sensor to track runtime:

- platform: history_stats
  name: ac_runtime_today_cool
  entity_id: sensor.thermostat_state
  state: "Cooling"
  type: time
  start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
  end: "{{ now() }}"

- platform: history_stats
  name: ac_runtime_today_heat
  entity_id: sensor.thermostat_state
  state: "Heating"
  type: time
  start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
  end: "{{ now() }}"

- platform: history_stats
  name: ac_runtime_yesterday_cool
  entity_id: sensor.thermostat_state
  state: "Cooling"
  type: time
  end: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
  duration:
    hours: 24

- platform: history_stats
  name: ac_runtime_yesterday_heat
  entity_id: sensor.thermostat_state
  state: "Heating"
  type: time
  end: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
  duration:
    hours: 24

@b0tt0mturn
Copy link
Author

So problem 2 is solved - thanks.

Problem 1 remains. Now, it is resetting all the heat temperatures to 69 and all the cool temperatures to 71. It is also changing all the period start times back to 0600, 0800, 1700, and 2200. I gather from your code that the wake, home, evening and sleep schedules correspond to period_id 1-4 respectively. Also guessing that htsp is the heat set-point and clsp is the cool set-point.....

On problem 3, my sensor.edenobservertstat_state is always "unknown".

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

It should be pretty straightforward to build the schedule. What would you envision as the method for setting that?

Providing a JSON or YAML file you populate with the schedule to the server? Setting via env variables on the container? I'm leaning towards filling out the schedule in a text file and having the server build the config but am open to ideas.

Something like:
{"day_1": { "time_1": "06:00", "time_1_cool": 75, "time_1_heat": 68, "time_2_start": "08:00"....

@b0tt0mturn
Copy link
Author

That would work great. But if someone were to change the schedule on the TSTAT0201CW itself, would that be updated on the server? I'm totally good with the yaml file, but the rest of the family, not so much :)

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

So would you expect the schedule to be set on the thermostat itself and never be overridden by the API server? I think that would be even easier, just accept what is there and then echo it back when the thermostat asks for updated settings.

@b0tt0mturn
Copy link
Author

From my standpoint, that would be ideal. I can always set a new schedule in HA with hold automations - that has been my stop gap. The downside is that there is some learning going on within the TSTAT0201CW that I can't take advantage of with a series of hold temps (if that makes sense).

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

Well I just removed the program data from the XML config POST response. That seems to allow the program to stay independent from the API server. Can you test the most recent image?

I also tweaked some of the PingRates to increase the performance.

@b0tt0mturn
Copy link
Author

So far so good! I'll keep you posted

The last thing is that my state is getting set to Unknown - can't see why, or even how that is possible given the code below (line 126)

"val_tpl": "{% if value_json.coolicon == 'on' %}Cooling{% elif value_json.heaticon == 'on' %}Heating{% elif value_json.fanicon == 'on' %}Idle Fan{% elif value_json.coolicon == 'off' and value_json.heaticon == 'off' and value_json.fanicon == 'off' %}Idle{% else %}Unknown{% endif %}",

Capture

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

Can you capture the MQTT message from the API server upon thermostat posting to /status? Here is mine:

homeassistant/climate/Thermostat/state {"rt": "71.0", "rh": "58", "mode": "heat", "fan": "auto", "coolicon": "off", "heaticon": "off", "fanicon": "off", "hold": "on", "filtrlvl": "1794", "clsp": "78", "htsp": "61", "oat": "65", "last_communication": "2024-02-03T03:13:32Z", "opstat": "", "iducfm": "0", "oducoiltmp": "64", "latest_equip": "No Active Event"}

Or better yet, a full packet capture from your api server host as you change a setting from HA, and the thermostat acknowledges the change. Network interface might be something like eth0 (you can check ifconfig)
sudo tcpdump -nn -i NETWORK_INTERFACE_NAME -w thermostat.pcap -s0 host THERMOSTAT_IP

It's also odd that some other values are Unknown or empty.

Screen Shot 2024-02-02 at 9 16 42 PM

@b0tt0mturn
Copy link
Author

Here's what I've got, I think

Received 8:37:03 PM
QoS: 0
Payload: latest_equip: No Active Event
rt: '70.0'
rh: '38'
mode: heat
fan: high
hold: 'on'
filtrlvl: '1714'
clsp: '70'
htsp: '70'
oat: '36'
last_communication: '2024-02-03T03:37:00Z'
iducfm: na
oducoiltmp: '33'

@b0tt0mturn
Copy link
Author

I don't have tcpdump and was struggling to find /status - I'm still on the low of the learning curve here.....

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

Are you using a raspberry pi? Do you know what operating system you are running? Do you have shell access to it over ssh?

@b0tt0mturn
Copy link
Author

I've got shell access to my Raspberry Pi and home assistant is a docker container installation - solely to support your server :)

NAME="Debian GNU/Linux"
VERSION_ID="12"

Looks like I can install tcpdump if you'd like me to. Thanks for your patience with me - I'm a retired engineering professor and my days of linux administration are decades behind me - things have changed!

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

Better yet, I just committed a change to output the raw data from the thermostat. Can you pull the latest image, redeploy your container, and send me the logs after a few minutes of it running? docker logs CONTAINER_NAME

@b0tt0mturn
Copy link
Author

rwn@edenrpi:/opt $ docker logs thermostat_api_server
Connecting to MQTT
Connected to MQTT
Subscribed to homeassistant/climate/EdenObserverTSTAT/cmnd/#
Published Config Entries
127.0.0.1 - - [03/Feb/2024 04:07:59] "GET /time HTTP/1.1" 200 -
127.0.0.1 - - [03/Feb/2024 04:08:59] "GET /time HTTP/1.1" 200 -
127.0.0.1 - - [03/Feb/2024 04:09:59] "GET /time HTTP/1.1" 200 -
127.0.0.1 - - [03/Feb/2024 04:10:59] "GET /time HTTP/1.1" 200 -

They Are generating, but how do I send you one?

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

It looks like the thermostat isn't communicating to your server, it might take a few minutes. I'm looking for something like:

thermostat_api_server              | Subscribed to homeassistant/climate/Thermostat/cmnd/#
thermostat_api_server              | Published Config Entries
thermostat_api_server              | DEBUG: /status -- <status version="1.7"><oat>65</oat><mode>heat</mode><fan>auto</fan><filtrlvl>1794</filtrlvl><servicelvl>0</servicelvl><rh>57</rh><lat>na</lat><day>6</day><zones><zone id="1"><rt>71.0</rt><hold>on</hold><otmr/><htsp>61</htsp><clsp>78</clsp><period>4</period><damper/><heaticon>off</heaticon><coolicon>off</coolicon><fanicon>off</fanicon></zone><zone id="2"/><zone id="3"/><zone id="4"/><zone id="5"/><zone id="6"/></zones></status>
thermostat_api_server              | DEBUG: {'rt': '71.0', 'rh': '57', 'mode': 'heat', 'fan': 'auto', 'coolicon': 'off', 'heaticon': 'off', 'fanicon': 'off', 'hold': 'on', 'filtrlvl': '1794', 'clsp': '78', 'htsp': '61', 'oat': '65'}
thermostat_api_server              | 10.0.0.29 - - [02/Feb/2024 22:13:17] "POST /systems/4518/status HTTP/1.1" 200 -
thermostat_api_server              | DEBUG: /odu_status -- <odu_status version="1.7"><odutype>ac2stgeverest</odutype><opstat>off</opstat><opstat/><iducfm>0</iducfm><lat>na</lat><oducoiltmp>64</oducoiltmp><blwrpm>na</blwrpm><oat>65</oat><mincoolstage/><maxcoolstage/><minheatstage/><maxheatstage/></odu_status>
thermostat_api_server              | 10.0.0.29 - - [02/Feb/2024 22:13:19] "POST /systems/4518/odu_status HTTP/1.1" 200 -
thermostat_api_server              | DEBUG: /status -- <status version="1.7"><oat>65</oat><mode>heat</mode><fan>auto</fan><filtrlvl>1794</filtrlvl><servicelvl>0</servicelvl><rh>57</rh><lat>na</lat><day>6</day><zones><zone id="1"><rt>71.0</rt><hold>on</hold><otmr/><htsp>61</htsp><clsp>78</clsp><period>4</period><damper/><heaticon>off</heaticon><coolicon>off</coolicon><fanicon>off</fanicon></zone><zone id="2"/><zone id="3"/><zone id="4"/><zone id="5"/><zone id="6"/></zones></status>
thermostat_api_server              | DEBUG: {'rt': '71.0', 'rh': '57', 'mode': 'heat', 'fan': 'auto', 'coolicon': 'off', 'heaticon': 'off', 'fanicon': 'off', 'hold': 'on', 'filtrlvl': '1794', 'clsp': '78', 'htsp': '61', 'oat': '65', 'last_communication': '2024-02-03T04:13:17Z', 'opstat': None, 'iducfm': '0', 'oducoiltmp': '64'}
thermostat_api_server              | 10.0.0.29 - - [02/Feb/2024 22:13:21] "POST /systems/4518/status HTTP/1.1" 200 -
thermostat_api_server              | DEBUG: /odu_status -- <odu_status version="1.7"><odutype>ac2stgeverest</odutype><opstat>off</opstat><opstat/><iducfm>0</iducfm><lat>na</lat><oducoiltmp>64</oducoiltmp><blwrpm>na</blwrpm><oat>65</oat><mincoolstage/><maxcoolstage/><minheatstage/><maxheatstage/></odu_status>
thermostat_api_server              | 10.0.0.29 - - [02/Feb/2024 22:13:23] "POST /systems/4518/odu_status HTTP/1.1" 200 -
thermostat_api_server              | DEBUG: /status -- <status version="1.7"><oat>65</oat><mode>heat</mode><fan>auto</fan><filtrlvl>1794</filtrlvl><servicelvl>0</servicelvl><rh>57</rh><lat>na</lat><day>6</day><zones><zone id="1"><rt>71.0</rt><hold>on</hold><otmr/><htsp>61</htsp><clsp>78</clsp><period>4</period><damper/><heaticon>off</heaticon><coolicon>off</coolicon><fanicon>off</fanicon></zone><zone id="2"/><zone id="3"/><zone id="4"/><zone id="5"/><zone id="6"/></zones></status>

@b0tt0mturn
Copy link
Author

had to power cycle the TSTAT

192.168.86.240 - - [03/Feb/2024 04:44:14] "POST /systems/2615N363586/status HTTP/1.1" 200 -
DEBUG: /odu_status -- <odu_status version="1.7">hp2stgeverestna033na36</odu_status>
192.168.86.240 - - [03/Feb/2024 04:44:16] "POST /systems/2615N363586/odu_status HTTP/1.1" 200 -
DEBUG: /status -- 36heatmed1712039669.0off70803
DEBUG: {'rt': '69.0', 'rh': '39', 'mode': 'heat', 'fan': 'med', 'hold': 'off', 'filtrlvl': '1712', 'clsp': '80', 'htsp': '70', 'oat': '36', 'last_communication': '2024-02-03T04:44:14Z', 'iducfm': 'na', 'oducoiltmp': '33', 'latest_equip': 'No Active Event'}
192.168.86.240 - - [03/Feb/2024 04:44:18] "POST /systems/2615N363586/status HTTP/1.1" 200 -
DEBUG: /odu_status -- <odu_status version="1.7">hp2stgeverestna033na36</odu_status>
192.168.86.240 - - [03/Feb/2024 04:44:19] "POST /systems/2615N363586/odu_status HTTP/1.1" 200 -
DEBUG: /status -- 36heatmed1712039669.0off70803
DEBUG: {'rt': '69.0', 'rh': '39', 'mode': 'heat', 'fan': 'med', 'hold': 'off', 'filtrlvl': '1712', 'clsp': '80', 'htsp': '70', 'oat': '36', 'last_communication': '2024-02-03T04:44:18Z', 'iducfm': 'na', 'oducoiltmp': '33', 'latest_equip': 'No Active Event'}
192.168.86.240 - - [03/Feb/2024 04:44:21] "POST /systems/2615N363586/status HTTP/1.1" 200 -
DEBUG: /odu_status -- <odu_status version="1.7">hp2stgeverestna033na36</odu_status>
192.168.86.240 - - [03/Feb/2024 04:44:24] "POST /systems/2615N363586/odu_status HTTP/1.1" 200 -
DEBUG: /status -- 36heatmed1712039669.0off70803
DEBUG: {'rt': '69.0', 'rh': '39', 'mode': 'heat', 'fan': 'med', 'hold': 'off', 'filtrlvl': '1712', 'clsp': '80', 'htsp': '70', 'oat': '36', 'last_communication': '2024-02-03T04:44:21Z', 'iducfm': 'na', 'oducoiltmp': '33', 'latest_equip': 'No Active Event'}
192.168.86.240 - - [03/Feb/2024 04:44:25] "POST /systems/2615N363586/status HTTP/1.1" 200 -
DEBUG: /odu_status -- <odu_status version="1.7">hp2stgeverestna033na36</odu_status>
192.168.86.240 - - [03/Feb/2024 04:44:27] "POST /systems/2615N363586/odu_status HTTP/1.1" 200 -
127.0.0.1 - - [03/Feb/2024 04:44:33] "GET /time HTTP/1.1" 200 -
192.168.86.240 - - [03/Feb/2024 04:44:39] "POST /systems/2615N363586/status HTTP/1.1" 200 -

@aneisch
Copy link
Owner

aneisch commented Feb 3, 2024

Would you mind pulling the latest image (again) and collecting the logs again?

@b0tt0mturn
Copy link
Author

Sorry for the delay - weekend family obligations - here is the latest

2024-02-05 15:31:35,508 -- INFO -- 192.168.86.240 -- POST -- /systems/2615N363586/odu_status
2024-02-05 15:31:36,898 -- DEBUG -- /status -- 33heatmed1665041268.0on68702
2024-02-05 15:31:36,899 -- DEBUG -- Current Configuration: {'iducfm': 'na', 'oat': '33', 'oducoiltmp': '33', 'latest_equip': 'No Active Event', 'rt': '68.0', 'rh': '41', 'mode': 'heat', 'fan': 'med', 'hold': 'on', 'filtrlvl': '1665', 'clsp': '70', 'htsp': '68', 'last_communication': '2024-02-05T15:31:33Z'}
2024-02-05 15:31:36,899 -- INFO -- 192.168.86.240 -- POST -- /systems/2615N363586/status
2024-02-05 15:31:38,972 -- DEBUG -- /odu_status -- <odu_status version="1.7">hp2stgeverestna033na33</odu_status>
2024-02-05 15:31:38,972 -- INFO -- 192.168.86.240 -- POST -- /systems/2615N363586/odu_status
2024-02-05 15:31:40,368 -- DEBUG -- /status -- 33heatmed1665041268.0on68702
2024-02-05 15:31:40,369 -- DEBUG -- Current Configuration: {'iducfm': 'na', 'oat': '33', 'oducoiltmp': '33', 'latest_equip': 'No Active Event', 'rt': '68.0', 'rh': '41', 'mode': 'heat', 'fan': 'med', 'hold': 'on', 'filtrlvl': '1665', 'clsp': '70', 'htsp': '68', 'last_communication': '2024-02-05T15:31:36Z'}
2024-02-05 15:31:40,370 -- INFO -- 192.168.86.240 -- POST -- /systems/2615N363586/status
2024-02-05 15:31:42,429 -- DEBUG -- /odu_status -- <odu_status version="1.7">hp2stgeverestna033na33</odu_status>
2024-02-05 15:31:42,430 -- INFO -- 192.168.86.240 -- POST -- /systems/2615N363586/odu_status
2024-02-05 15:31:43,912 -- DEBUG -- /status -- 33heatmed1665041268.0on68702
2024-02-05 15:31:43,913 -- DEBUG -- Current Configuration: {'iducfm': 'na', 'oat': '33', 'oducoiltmp': '33', 'latest_equip': 'No Active Event', 'rt': '68.0', 'rh': '41', 'mode': 'heat', 'fan': 'med', 'hold': 'on', 'filtrlvl': '1665', 'clsp': '70', 'htsp': '68', 'last_communication': '2024-02-05T15:31:40Z'}
2024-02-05 15:31:43,914 -- INFO -- 192.168.86.240 -- POST -- /systems/2615N363586/status
2024-02-05 15:31:45,878 -- DEBUG -- /odu_status -- <odu_status version="1.7">hp2stgeverestna033na33</odu_status>
2024-02-05 15:31:45,879 -- INFO -- 192.168.86.240 -- POST -- /systems/2615N363586/odu_status

@aneisch
Copy link
Owner

aneisch commented Feb 5, 2024

Your thermostat is sending data in a different format:
2024-02-05 15:31:40,368 -- DEBUG -- /status -- 33heatmed1665041268.0on68702

Mine:
2024-02-05 11:21:31,649 -- DEBUG -- /status -- <status version="1.7"><oat>63</oat><mode>heat</mode><fan>auto</fan><filtrlvl>1794</filtrlvl><servicelvl>0</servicelvl><rh>56</rh><lat>na</lat><day>2</day><zones><zone id="1"><rt>68.0</rt><hold>on</hold><otmr/><htsp>60</htsp><clsp>78</clsp><period>2</period><damper/><heaticon>off</heaticon><coolicon>off</coolicon><fanicon>off</fanicon></zone><zone id="2"/><zone id="3"/><zone id="4"/><zone id="5"/><zone id="6"/></zones></status>

Not sure what up with that but it explains why the Home Assistant templates are failing. Perhaps this is due to a varied firmware version on the thermostat?

Can you grab data from /profile in the logs?

aneisch $ docker logs CONTAINER_NAME 2>&1 | grep "/profile"

2024-02-04 12:23:29,578 -- DEBUG -- /profile -- <system_profile version="1.7"><pin>988E31</pin><brand>heil</brand><model>TSTAT0201CW</model><serial>45</serial><firmware>CESR131611-6.10</firmware><indoorModel>-----</indoorModel><indoorSerial>-----</indoorSerial><iduversion>---</iduversion><idustages>2</idustages><iducapacity>89</iducapacity><outdoorModel>-----</outdoorModel><outdoorSerial>-----</outdoorSerial><oduversion>---</oduversion><oducapacity>60</oducapacity><routerMac>58</routerMac><zones><zone id="1"><zoneSensor>touch_tstat</zoneSensor></zone><zone id="2"><zoneSensor>sensor</zoneSensor></zone><zone id="3"><zoneSensor>sensor</zoneSensor></zone><zone id="4"><zoneSensor>sensor</zoneSensor></zone><zone id="5"><zoneSensor>sensor</zoneSensor></zone><zone id="6"><zoneSensor>sensor</zoneSensor></zone></zones></system_profile>
2024-02-04 12:23:29,578 -- INFO -- 10.0.0.29 -- POST -- /systems/4518M169324/profile

@b0tt0mturn
Copy link
Author

docker logs thermostat_api_server 2>&1 | grep "/profile" didn't return anything, but the Thermostat Application Version number listed on the Observer is 4.02

@b0tt0mturn
Copy link
Author

Hey Andrew - I totally understand if this version issue is low on your priority list - the system state is not a big deal for me. But is there any chance you can update the image to log less frequently? Thanks

@aneisch
Copy link
Owner

aneisch commented Feb 12, 2024

I haven't forgotten about you! It's on my list to figure something out with the version.

As far as logging, if you set LOG_LEVEL=INFO in your docker-compose file or pass that as an environment variable to your container the logspam will slow down. If you want zero logs, you should be able to set LOG_LEVEL=ERROR

@b0tt0mturn
Copy link
Author

b0tt0mturn commented Feb 16, 2024

I just upgraded my WiFi to Google Nest last night because they are also thread border routers (and work great so far, BTW). In the process I realized that I needed a static IP for my RPi. I edited my docker compose and restarted everything which pulled your latest version, but now I'm getting the error below. Did I screw something up my MQTT server or has something changed in the code?

Traceback (most recent call last):
File "/usr/bin/thermostat_api_server.py", line 412, in
client = mqttClient.Client(f"thermostat_api_server_{thermostat_serial}")
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 766, in init
raise ValueError(
ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see migrations.md for details

@b0tt0mturn
Copy link
Author

Hang on - I think it's me. Hard to tell which device is my Home Assistant, but suspect it's the one that says Home Assistant Container......

@aneisch
Copy link
Owner

aneisch commented Feb 17, 2024

It's on me. I didn't pin module versions and Paho had a breaking change. Fixed in 722a1b3

@b0tt0mturn
Copy link
Author

Still having connection issues - here's my latest log. I've confirmed that the IP of the MQTT broker and the API server are the same as the Pi. The port of the broker is 1883 and for the server, its 8080. I've noticed that both my Raspberry Pi and my HA docker container have IP addresses - I'm assuming that the IP for the Pi is the one I should be using - is that right? If not, then that may be my problem

2024-02-18 15:22:30,030 -- INFO -- Connecting to MQTT
Traceback (most recent call last):
File "/usr/bin/thermostat_api_server.py", line 425, in
client.connect(mqtt_address, mqtt_port)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1429, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1592, in reconnect
self._sock = self._create_socket()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 4598, in _create_socket
sock = self._create_socket_connection()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 4623, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
File "/usr/local/lib/python3.8/socket.py", line 808, in create_connection
raise err
File "/usr/local/lib/python3.8/socket.py", line 796, in create_connection
sock.connect(sa)

@aneisch
Copy link
Owner

aneisch commented Feb 19, 2024

Please check the IP you are passing to this container in the MQTT_SERVER variable. This IP should be the one of the server running mosquitto.

@b0tt0mturn
Copy link
Author

I changed it in the docker compose to the IP of the Pi, which is a 192.168.XX.XX - it had been the IP listed in Portainer, which is a 172.18.x.x

Now my log looks like this - things I do in HA seem to be logged, but they are not actually registering with the thermostat. And things done to the thermostat are not registering in the log. Nor did the server download the current setting of the tstat. But it seems to be connecting at least!

2024-02-20 04:06:19,011 -- INFO -- Connecting to MQTT
2024-02-20 04:06:19,016 -- INFO -- Connected to MQTT
2024-02-20 04:06:19,016 -- INFO -- Subscribed to homeassistant/climate/EdenObserverTSTAT/cmnd/#
2024-02-20 04:06:19,018 -- INFO -- Published Config Entries
2024-02-20 04:07:17,961 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:08:18,134 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:09:18,357 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:09:37,667 -- INFO -- New message: homeassistant/climate/EdenObserverTSTAT/cmnd/fan_mode auto
2024-02-20 04:10:18,537 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:11:18,974 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:12:19,215 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:13:19,614 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:14:18,552 -- INFO -- New message: homeassistant/climate/EdenObserverTSTAT/cmnd/temperature 66.0
2024-02-20 04:14:20,212 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:15:20,431 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:16:20,651 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:17:20,838 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:18:21,055 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:19:21,271 -- INFO -- 127.0.0.1 -- GET -- /time
2024-02-20 04:20:00,089 -- INFO -- New message: homeassistant/climate/EdenObserverTSTAT/cmnd/fan_mode med
2024-02-20 04:20:12,651 -- INFO -- New message: homeassistant/climate/EdenObserverTSTAT/cmnd/fan_mode low

@aneisch
Copy link
Owner

aneisch commented Feb 20, 2024

That's a good sign. I'd check this now: #4 (comment)

@b0tt0mturn
Copy link
Author

That works.

2024-02-20T13:57:31Z

power cycled the tstat and restarted HA - still not able to control the thermostat from HA. I had enabled MQTT logging - here is some output in case that is helpful:

2024-02-19 21:30:17.256 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/sensor/2615N363586-last-time/config (qos=0): b'{"device": {"mdl": "TSTAT0201CW", "mf": "Observer", "ids": "2615N363586", "name": "EdenObserverTSTAT"}, "stat_t": "homeassistant/climate/EdenObserverTSTAT/state", "val_tpl": "{{ value_json.last_communication }}", "name": "EdenObserverTSTAT Last Communication", "ic": "mdi:clock", "uniq_id": "2615N363586-last-time"}'
2024-02-19 21:30:17.258 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'device': {'model': 'TSTAT0201CW', 'manufacturer': 'Observer', 'identifiers': '2615N363586', 'name': 'EdenObserverTSTAT'}, 'state_topic': 'homeassistant/climate/EdenObserverTSTAT/state', 'value_template': '{{ value_json.last_communication }}', 'name': 'EdenObserverTSTAT Last Communication', 'icon': 'mdi:clock', 'unique_id': '2615N363586-last-time', 'platform': 'mqtt'}
2024-02-19 21:30:17.259 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor 2615N363586-last-time, sending update
2024-02-19 21:30:17.259 DEBUG (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', '2615N363586-last-time') '{'device': {'model': 'TSTAT0201CW', 'manufacturer': 'Observer', 'identifiers': '2615N363586', 'name': 'EdenObserverTSTAT'}, 'state_topic': 'homeassistant/climate/EdenObserverTSTAT/state', 'value_template': '{{ value_json.last_communication }}', 'name': 'EdenObserverTSTAT Last Communication', 'icon': 'mdi:clock', 'unique_id': '2615N363586-last-time', 'platform': 'mqtt'}'
2024-02-19 21:30:17.259 DEBUG (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.edenobservertstat_last_communication
2024-02-19 21:30:17.259 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', '2615N363586-last-time'): deque([])
2024-02-19 21:31:11.291 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on homeassistant/climate/EdenObserverTSTAT/cmnd/temperature: '64.0', mid: 7, qos: 0
2024-02-19 21:31:37.916 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on homeassistant/climate/EdenObserverTSTAT/cmnd/fan_mode: 'auto', mid: 8, qos: 0
2024-02-19 21:31:42.007 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on homeassistant/climate/EdenObserverTSTAT/cmnd/fan_mode: 'low', mid: 9, qos: 0
2024-02-19 23:05:29.429 WARNING (MainThread) [homeassistant.components.sonos.speaker] No recent activity and cannot reach Office, marking unavailable
2024-02-19 23:55:29.491 WARNING (MainThread) [homeassistant.components.sonos.speaker] No recent activity and cannot reach Office, marking unavailable
2024-02-20 00:45:29.537 WARNING (MainThread) [homeassistant.components.sonos.speaker] No recent activity and cannot reach Office, marking unavailable
2024-02-20 01:35:29.593 WARNING (MainThread) [homeassistant.components.sonos.speaker] No recent activity and cannot reach Office, marking unavailable
2024-02-20 02:29:34.548 WARNING (Thread-8) [pychromecast.socket_client] [Funk Room(192.168.86.34):8009] Heartbeat timeout, resetting connection
2024-02-20 02:29:50.048 ERROR (Thread-8) [pychromecast.socket_client] [Funk Room(192.168.86.34):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.86.34', 8009)), retrying in 5.0s
2024-02-20 03:15:48.274 ERROR (Thread-7) [pychromecast.socket_client] [Funk Room Wifi(192.168.86.40):8009] Error reading from socket.
2024-02-20 03:15:48.275 WARNING (Thread-7) [pychromecast.socket_client] [Funk Room Wifi(192.168.86.40):8009] Error communicating with socket, resetting connection
2024-02-20 03:15:48.285 ERROR (Thread-7) [pychromecast.socket_client] [Funk Room Wifi(192.168.86.40):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.86.40', 8009)), retrying in 5.0s
2024-02-20 04:17:10.383 ERROR (Thread-6) [pychromecast.socket_client] [Kitchen Wifi(192.168.86.39):8009] Error reading from socket.
2024-02-20 04:17:10.384 WARNING (Thread-6) [pychromecast.socket_client] [Kitchen Wifi(192.168.86.39):8009] Error communicating with socket, resetting connection
2024-02-20 04:17:10.392 ERROR (Thread-6) [pychromecast.socket_client] [Kitchen Wifi(192.168.86.39):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.86.39', 8009)), retrying in 5.0s

@b0tt0mturn
Copy link
Author

Still can't control of the tstat from home assistant, so I'd like to try it from an earlier version. How would I modify my docker compose to rollback to your version 00abac6? I tried

image: ghcr.io/aneisch/thermostat_api_server:00abac6-arm64 to no avail

@b0tt0mturn
Copy link
Author

check all that - back up and running again after some restarts etc - the observer api was resetting to the default after every power cycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants