vpathuis / ultraheat

MIT License
5 stars 3 forks source link

Testing mode without IR reader module? #11

Closed jeGit closed 1 year ago

jeGit commented 1 year ago

Hi and thanks for your work. I want to test the HA integration before deciding to buy an IR reader. But it always ask for a connection when running the integration for the 1st time. I even tried to install it manually as custom component. Could you pls help me to explain what I need to comment out in your code (config_flow.py?) to get the rest configured? Thx, Jens

vpathuis commented 1 year ago

Hi, the module has a testing mode using a file instead of a serial connection, see https://github.com/vpathuis/ultraheat/tree/master/tests. This won't work in the HA-integration however, since the HA-production environment won't allow me such testing modes. But if you're testing locally you can try adding the following code just after reader = ultraheat_api.UltraheatReader(entry.data[CONF_DEVICE]), in both config_flow.py and __init.py:

    reader = ultraheat_api.FileReader("LUGCUH50_dummy.txt")

Place the dummy file in the same folder as the customer component code. I'm not entirely sure this works, haven't tested it this way.

jeGit commented 1 year ago

Ihm, too bad, I thought I would be able to get the integration (even as a custom integration) up and running to see how the entities and addtl. entries are made available in HA. I'm not good at reading code and I have a Tasmota WiFi (MQTT) integration running but struggle to get the values sorted, assigned and show up in a meaningful way in the dashboard. Learning from example is always the best. So, I might end up buying the USB IR reader and give it a try. Thx.

vpathuis commented 1 year ago

I'll try and see if I can set it up for you to test. I'll need a bit of time, perhaps later today.

vpathuis commented 1 year ago

Alright, this should work. Download the following files as a custom component: https://github.com/vpathuis/core/tree/testing-without-serial/homeassistant/components/landisgyr_heat_meter

Now also place one of the dummy files from this folder in the same custom component folder: https://github.com/vpathuis/ultraheat/tree/master/tests Rename the dummy file to LUGCUH50_dummy.txt

Add the integration and fill in a random value for USB-path. This will be ignored.

After you first add the integration, no values will be available. Polling is set very slow to preserve battery (this will change in the future though). To poll manually, go to services and choose the "Home Assistant Core Integration: Update entity" service. Now update sensor.heat_meter_heat_usage_gj (or any of the other entities from the ingration). This should trigger the poll and read the file. Change the values in the file (without reboot) and poll again.

Hope this helps.

jeGit commented 1 year ago

Wow, works like a charm. Build an automation for the manual update. Thx. OUTSTANDING SUPPORT"!"""