I have an custom set of sensors that read data from my Solvis Max controller. It is build using a command line sensor like this:
- platform: command_line
name: SolvisMax
command: "python3 /config/scripts/solvis.py"
json_attributes:
- Anlagentyp
- Systemnummer
- Tank_Top
- Warmwasser
- Tank_Bottom
- Tank_MidTop
- HeatPump_Feed
- HeatPump_Back
- S7
- HeatPump1
- Tank_MidBottom
- OutsideTemp
- WWCycleBack
- HK1_Feed
- HK2_Feed
- BoilerSensor
- HeatPump2
- S16
- VolumeWW
- Volume_Heatpump
- S19
- S20
- S21
- Modulation_Boiler
- S23
- S24
- S25
- S26
- S27
- S28
- Pump_HeatPump
- Pump_WW
- Pump_HK1
- Pump_HK2
- Pump_WWCycle
- Pump_HK3
- Pump_Solar2
- HK1_Mix_Open
- HK1_Mix_Close
- HK2_Mix_Open
- HK2_Mix_Close
- Boiler_NA
- Charge_Pump_Boiler
- Boiler
- Modulation_Boiler_Soll
- Modulation_Delta
value_template: "{{ state_attr('sensor.solvismax', 'Tank_Top') }}"
unit_of_measurement: "°C"
the python script that decodes the data from the controller worked for over one year, but stopped working some weeks ago (I keep my Homeassistant as current as possible).
#!/usr/bin/python3
import requests
from requests.auth import HTTPDigestAuth
def hextoint ( s ):
# print ("hextoint s="+s)
if len(s) > 2:
h = s[2:4]+s[0:2]
else :
h = s[0:2]
# print ("hextoint h="+h)
return int ( h, base = 16)
r = requests.get('http://solvis.xxxxx.xx/sc2_val.xml', params = {'dummy':'42'} , auth = HTTPDigestAuth('admin', 'xxxxx'))
start = r.text.find("<data>")
ende = r.text.find("</data>")
s = r.text[start + 6 : ende]
s = s[18:]
print( '{')
print ( ' "Anlagentyp":"'+str(hextoint(s[0:4]))+'",')
s = s[4:]
# Decoding of the message follows here, quite long
I seems that the requests module has been removed.
But even the documentation of the command line sensor suggests using a python script to poll values from a remote device. https://www.home-assistant.io/integrations/command_line#use-an-external-script
I there a way to re-install this module ?