with a little help of the TA-Support, I have developed a way to read also Variables from within Logic Blocks and transfer them to HA.
As an example, for a PID Block, these Values are available:
The only thing you need to do is to create a Schema with TA-Designer. We need the resulting xml (and it must be uploaded to CMI/BLNet).
The other prerequisite is an MQTT Broker and the MQTT Integration in HA.
All of this runs in a python script with little dependencies.
Then, the only configuration is this:
In HA, the result is an MQTT Device that has the different Sensors as Entities. As soon as the XML is updated (and the script restarted) the new Entities are created automatically. No configuration in HA needed (auto-discovery)
If there is any Interest, I am happy to share the code (until then, I will keep improving it ).
Hey Hendrik,
after struggeling yesterday, hanging around in the linked post⌠Iâld be super greatful if you coud share your little python code!
Best regards,
Pete
Hello Hendrik,
Iâm new to Homeassistant and stumbled across your post. Unfortunately I canât get any further when executing the script. HA returns this error.
Fehler beim Aufrufen des Diensts python_script.send_uvr_mqtt.py. Service python_script.send_uvr_mqtt.py does not match format . for dictionary value @ data[âsequenceâ][0][âserviceâ]. Got âpython_script.send_uvr_mqtt.pyâ
I can not do anything with that. Can you help me with something?
greeting
Janusz
Hi,
so I got back to the project⌠but it seems I have some issue running the code, too.
So far:
MQTT is running, CMI has a scheme and can be accessed by IPâŚ/schema.html
When running the code in python I get the following error:
Logger: homeassistant.components.python_script.send_uvr_mqtt.py
Source: components/python_script/__init__.py:224
Integration: Python Scripts (documentation, issues)
First occurred: 22:00:29 (1 occurrences)
Last logged: 22:00:29
Error executing script: __import__ not found
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 224, in execute
exec(compiled.code, restricted_globals) # noqa: S102
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "send_uvr_mqtt.py", line 1, in <module>
ImportError: __import__ not found
Can you explain your set up more detailed, please. What do you mean by stand alone?
Very good job. Good alternative to the Technische Alternative integration from which I can only get the predefined loggers. With your tool, I can get all the data defined in TA designer.
I run it inside Home Assistant OS. I am using a node-red flow that creates/checks for a virtual environment, installs the required libraries and then executes the code.
Running it using any other options for running python code within HA was too complicated. This is something I donât understand. Why is it so difficult to run python code via an automation or a plugin on a python based frameworkâŚ
I have not tested it with pyscript as I have no experience with it.
Please run it outside Homeassistant. The Sensors will appear in the mqtt-integration.
Hendrik, great! Your solution finally seems to be something that works more reliably than the query via web frontend or ModBus.
I am currently using the ModBus integration in HA and neither the input nodes are correct for me (5 is actually outside temperature, but is displayed under input 11) nor do the values fit properly.
It is frustrating. It worked better with ioBroker.
Could you please explain to me how this works with the Pyton script? Iâve never done anything with Pyton before and Iâm not very confident with Home Assistant either.
Thank you Hendrik for your answer.
Let me summarize again so that I have understood everything correctly:
I download your code from GitHub
then I adapt the file âsend_uvr_mqtt.pyâ as follows:
mqtt_config = {
âbroker": â192.168.177.3â, ## <-- This ist the IP Adress from my Home Assistant Environment
âport": 1883,
âuser": âuserâ,
âpassword": âpassâ
}
uvr_config = {
âxml_filename": âNew.xmlâ, ## <-- this is the file name of my configuration file, which I used to program the UVR
âip": â192.168.177.5â, ## <-- this ist the IP Adress of my CMI Device
âuser": âuserâ,
âpassword": âpassâ
}
I copy the TA-Designer project saved as XML, from which I created and uploaded the UVR1611 configuration, into the same folder as your code.
Since I have a NAS on which Pyton is already running, I log in there via terminal and copy your files and my xml File into a folder there
finally, I execute your script once on the command line:
I executed the script in my Python runtime environment (on the Synology NAS). As a result, the new MQTT device became visible in Home Assistant with the entities in it.