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

Tywatt support #20

Closed
nels83 opened this issue Apr 3, 2022 · 23 comments
Closed

Tywatt support #20

nels83 opened this issue Apr 3, 2022 · 23 comments

Comments

@nels83
Copy link
Contributor

nels83 commented Apr 3, 2022

Is it possible to add support for Tywatt ?

I use it with tydom-client and mqtt by hand for now and it works really well (integrated in the new Energy panel!). Only problem is that it needs polling so I don't know if it would be easy for you.

Here is an example of how I use it (no error handling, really quick an dirty and first HA dev so there may be mistakes) :

Discover : mosquitto_pub -r -h 127.0.0.1 -p 1883 -t "homeassistant/sensor/tydom_power_total/config" -m '{"unique_id": "tydom_power_total", "name": "Total consumption", "unit_of_measurement": "Wh", "device_class": "energy", "state_class": "total_increasing", "state_topic": "homeassistant/sensor/tydom_power_total/state"}'

Get data : request /devices/XXXX/endpoints/XXXX/cdata?name=energyIndex&dest=ELEC_TOTAL&reset=false --username USER --password PASS --hostname IP --command

Update : mosquitto_pub -r -h 127.0.0.1 -p 1883 -t "homeassistant/sensor/tydom_power_total/state" -m VALUE

You can replace ELEC_TOTAL with ELEC_HEATING, ELEC_COOLING, ELEC_HOTWATER, ELEC_OUTLET, ELEC_OTHER (you can get the list using request /devices/cmeta)

I don't think energyHisto and energyDistrib commands would be of any use, however energyInstant is interesting (using "unit_of_measurement": "VA", "device_class": "current", "state_class": "measurement").

Thanks for the great software !

@BlacKTM1190
Copy link
Collaborator

BlacKTM1190 commented Apr 11, 2022

Hello
I saw your great works on your repo for Tywatt's integration.
I'm also interested in this and ready to help, even if I have little knowledge of python (as well as my English 😇).
Moreover, this could give clue to temp sensor on #19.
Although, I understood that @mrwiwi left the project to @fmartinou (right?), so that's the right place to PR, but would a beta branch be needed ?

@nels83
Copy link
Contributor Author

nels83 commented Apr 11, 2022

Hello,
You're right, I did not notice I was responding to the old repo. I'll delete the old message and repost it here.

@nels83
Copy link
Contributor Author

nels83 commented Apr 11, 2022

Hello,
Here is a first try at tydom2mqtt integration : https://github.com/nels83/tydom2mqtt/tree/tywatt
Tywatt should be detected and entities created (only indexes for now). 'state_class' is set to 'total_increasing' so statistics can be enabled in HA.
Data is pulled each time refresh is called.

I'm just discovering the code (and python) so there is definitely room for improvement...

@fmartinou
Copy link
Collaborator

Hi,
I'm sorry not to be very available these days... I'm running out of time.

Although, I understood that @mrwiwi left the project to @fmartinou (right?), so that's the right place to PR, but would a beta branch be needed ?

Yes, that's the right place.

@mrwiwi is the original creator of the project.

I forked it few months ago for my own needs and brought it further (docker image, ha addon, continuous integration...).

This fork is now the new lead project.

@mrwiwi is still part of the developers (actually he is the tydom protocol expert, not me).

@fmartinou
Copy link
Collaborator

Hi @nels83

Thanks for your contribution 👍.

May you create a pull request on this repository?

I'll merge it on a feature branch so that anyone can test your feature (personally, I don't have the needed hardware to test it on my end).

@nels83
Copy link
Contributor Author

nels83 commented Apr 13, 2022

@fmartinou Done ;-) My feature/tywatt branch is a refactor of the first try. It should be complete and follow the tydom2mqtt coding style.

@nels83
Copy link
Contributor Author

nels83 commented Apr 13, 2022

As a bonus, here is my HA configuration for energy costs (in configuration.yaml, it took me some time to figure out a simple way of defining these):

template:
  - sensor:
      - name: "Tarif Bleu EDF"
        unit_of_measurement: EUR/kWh
        state: >
          {% set tarif = { "HP": 0.1841, "HC": 0.1470 } %}
          {% if now() >= today_at("07:30") and now() < today_at("23:30") %}
            {{ tarif.HP }}
          {% else %}
            {{ tarif.HC }}
          {% endif %}

@fmartinou
Copy link
Collaborator

Hi @nels83 ,

Thanks for the PR!
It has been merged to the feature/#21 branch.
You can give a try to the resulting image tagged as fmartinou/tydom2mqtt:feature__21

I have no means to test the image by myself because I don't have the related hardware; can you test it, please?
If you confirm it's OK,, then I'll release a new version including your enhancement 😃

Thank you for your contribution!

@nels83
Copy link
Contributor Author

nels83 commented Apr 20, 2022

Hey @fmartinou,

Thanks for the feature branch. However I noticed I did not push the right code in the PR. There's a typo : I used "pull" instead of "poll". Do you mind if I create a new PR with another branch?

@fmartinou
Copy link
Collaborator

Please create a new PR to the feature/#21 branch ;)

@fmartinou
Copy link
Collaborator

The image fmartinou/tydom2mqtt:feature__21 has been overwritten.

@nels83
Copy link
Contributor Author

nels83 commented Apr 21, 2022

Everything works for me. I'm interested by other people's experience ;-)
A test by someone who does not own a Tywatt would also be great to make sure I didn't break something.

@fmartinou
Copy link
Collaborator

A test by someone who does not own a Tywatt would also be great to make sure I didn't break something.

I'll perform some tests on my end.

@netdrg
Copy link

netdrg commented Apr 26, 2022

Hello i'm very interesting with this part of tydom2mqtt, i'm testing tywatt and connection with tydom box crash sometimes 8h, 2 days a need to reboot the tydom box with fmartinou/tydom2mqtt 2.10 no problems. You can integrate other ELEC HOT WATER ?

Thank's for you job ;)

@nels83
Copy link
Contributor Author

nels83 commented Apr 26, 2022

Hello,
Sensors should be detected automatically. For example, at home I have ELEC_HEATING, ELEC_HOTWATER, ELEC_OTHER, ELEC_OUTLET and ELEC_TOTAL.
My tydom box is up for many months now and I never had to reboot it.
Can you send the log file so I can take a look?

@netdrg
Copy link

netdrg commented May 3, 2022

tydom2mqtt.csv

Hello nels ,you can view log attached. I don't have in mqtt ELEC_HEATING, ELEC_HOTWATER, ELEC_OTHER, ELEC_OUTLET but in my deltadore app i have this infomations. i have always need reboot box some times. I'm use tydom2mqtt in local connected in 192.168.X.X.
Thank's in advance

@nels83
Copy link
Contributor Author

nels83 commented May 3, 2022

Hello netdrg,

Indexes are discovered, you have all GET /devices/1533910287/endpoints/1533910291/cdata?name=energyIndex&dest=ELEC_XXX&reset=false lines in your log.

However entity is sent through MQTT only if there is data. It seems to be the case for ELEC_TOTAL and ELEC_A :
2022-04-26 08:41:42,stdout,"2022-04-26 08:41:42,692 - sensors - INFO - Sensor created / updated : ELEC_TOTAL_tydom__Tywatt 23927170
2022-04-26 08:41:42,stdout,"2022-04-26 08:41:42,494 - sensors - INFO - Sensor created / updated : ELEC_A_tydom__Tywatt 500

Maybe your Tywatt is not connected to ELEC_HEATING etc. (that's my case, I don't have data for ELEC_OTHER and ELEC_HEATING).

You can try NODE_TLS_REJECT_UNAUTHORIZED=0 npx tydom-client request /devices/1533910287/endpoints/1533910291/cdata?name=energyIndex\&dest=ELEC_OTHER\&reset=false --username USER --password PASSWORD --hostname 192.168.X.X --command to see if something is returned.

I also see TEMP_OUTDOOR and TEMP_INDOOR but I doubt they are indexes. Can you send me the log of
NODE_TLS_REJECT_UNAUTHORIZED=0 npx tydom-client request /devices/cmeta --username USER --password PASSWORD --hostname 192.168.X.X ?

Thanks for your help!

@BlacKTM1190
Copy link
Collaborator

Hello
Sorry for the delay but I couldn't connect my tywatt to my tydom anymore...
I had to call Delta Dore, who, by the way, now forces us to create the famous account in order to add them as a member, they no longer want a temporary password... :/
However, many thanks @nels83 for this huge work.
For now, I only get ELEC_A and ELEC_TOTAL because, in the battle before calling Delta Dore, I did a factory reset...
So I need to re-pair my outdoor temperature and sunshine sensors.
Keep in touch ;)

@Muspi
Copy link

Muspi commented Jun 28, 2022

Bonjour,
est-ce qu'il y a du nouveau concernant le support de Tywatt?

@fmartinou
Copy link
Collaborator

I've just merged the feature/#21 branch and released it as a new 2.2.0 version so that most people can test it.

Hope it works well 🤞 .

@BlacKTM1190
Copy link
Collaborator

Hello
Sry, I intentionally didn't give an answer, 'cause @nels83' PRs worksjust fine but verbose make me wondering if it's not generating other issues (like hang Synology container)... Elec_A, ELEC_TOTAL and Out Temperature works fine, however I see inner temp in log but not in homeassistant payload...

@Muspi
Copy link

Muspi commented Jun 29, 2022

tywatt

Super, j'ai bien la consommation tywatt qui remonte, impec

@gypais
Copy link

gypais commented Jul 12, 2024

Tout semble fonctionner, sauf la température qui reste à 0 sur mon tywatt 1000. Y a-t-il un moyen pour trouver le problème ?

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

6 participants