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

vzlogger - Add support for more configuration values #1

Open
seppelw opened this issue Aug 30, 2021 · 26 comments
Open

vzlogger - Add support for more configuration values #1

seppelw opened this issue Aug 30, 2021 · 26 comments

Comments

@seppelw
Copy link
Contributor

seppelw commented Aug 30, 2021

Hello @m-reuter ,

I really appreciate your work, but unfortunately need some more configuration options for my use case.
My meter is using d0 protocol and spits out a message every second. Therefore i need to be able to set the "interval" parameter for a meter...and of course set the protocol to d0 instead of sml.
Currently this is not included in your vzlogger.conf and the default settings. I'm trying to get this in with a pull request but I'm struggling with getting a working development environment with travis-ci...

@m-reuter
Copy link
Owner

Yes, I only implemented a very limited amount of parameters for the initial release. Would be great to support more configuration options. I also don't really have a separate development environment. Had been testing directly on this repo with travis docker builds and then HomeAssistant would receive updates directly. If you find out a not too difficult alternative, let me know. In the worst case we need to merge an untested pull request and directly try it out.

@seppelw
Copy link
Contributor Author

seppelw commented Aug 30, 2021

I'm trying to get this up and running in a local dev environment...so it's at least somehow checked and we're not completely blind for a merge.

@jpfaff
Copy link

jpfaff commented Aug 31, 2021

Hi,
Sorry for the intrusion, I also have to premise that I have very little experience with home assistant add-ons.
To my point: wouldn't it be easiest to have one single string option in the add-on config that includes the "meters" list of vzlogger? From my understanding the add-on config is not that flexible to cover all of vzlogger options.
Obviously this is not that nice in the home assistant UI and also a validation is not really possible.

@m-reuter
Copy link
Owner

m-reuter commented Sep 1, 2021

I think with the new setup and naming convention here, we can now easily add more parameters and even more meters in the future if needed. Thanks for the contribution.

@jpfaff
Copy link

jpfaff commented Sep 1, 2021

Ok, I will try to adapt it to my setup (up to 4 meters with some additional parameters) as soon as I have access to it and hopefully I can merge it back here if it works.
Thank you for your work.

@seppelw
Copy link
Contributor Author

seppelw commented Sep 1, 2021

@jpfaff adding more meters should be pretty straight forward. Just copy and paste whats there and change the numbers.
I'm thinking about adding a blank string parameter that gets added per meter and also a blank string parameter that gets added in general to the vzlogger.conf file. That way it's more flexible but still somehow configurable without using to much effort.

@jpfaff
Copy link

jpfaff commented Sep 1, 2021

@jpfaff adding more meters should be pretty straight forward. Just copy and paste whats there and change the numbers.
I'm thinking about adding a blank string parameter that gets added per meter and also a blank string parameter that gets added in general to the vzlogger.conf file. That way it's more flexible but still somehow configurable without using to much effort.

I think that would be a great middle way between the two approaches. Leaving the possibility to people that need it, but keeping the basic setups simple.

@dAjaY85
Copy link

dAjaY85 commented Sep 10, 2021

Hello @m-reuter,

this ist a very good Idea to integrade the VZLogger into HomeAssistant, but i am not able to transform my working config from vzlogger to this add-on:

meter1_parity: 7E1 => error, add-on don't accept "E"

This both commands working?
I was not able to find something about it in the Documentation:
meter1_pullseq: 2F3F210D0A
meter1_ackseq: 063030300D0A

@m-reuter
Copy link
Owner

Hi @dAjaY85 ,
not sure what the not accept "E" means? But the other two variables pullseq and ackseq are not supported currently in this Addon (see the documentation for what variables are available). So:

  1. can you be more specific what you mean that "E" is not accepted? Is there an error message?
  2. are any other variables in your config that you cannot find in the README ?
    It would be easy to add pullseq and ackseq, but we need to make sure that there is nothing else missing.

@dAjaY85
Copy link

dAjaY85 commented Sep 10, 2021

Hi @m-reuter,

when I put an "E", the add-on shows an error, configuration is not right.
VZLogger have some Viariables:
The first one are the Data bits: 5, 6, 7 or 8
second one are the Parity: -N => None; E => Even; M => Mark; O => Odd; S => Space.
the last one is the Stop bit: 1 or 2

I copy my working VZLogger config file, i think with integrated pullseq and ackseq it should work.

vzlogger.txt

@m-reuter
Copy link
Owner

m-reuter commented Sep 10, 2021

Commit 9cb12e0 adds support pullseq and ackseq. Let me know if it works, or if other variables are needed.
It will take a while (30-40min) until all Docker Images are built. Then it should become available as version 0.9.2

@seppelw
Copy link
Contributor Author

seppelw commented Sep 10, 2021

Hi @m-reuter,

when I put an "E", the add-on shows an error, configuration is not right.
VZLogger have some Viariables:
The first one are the Data bits: 5, 6, 7 or 8
second one are the Parity: -N => None; E => Even; M => Mark; O => Odd; S => Space.
the last one is the Stop bit: 1 or 2

I copy my working VZLogger config file, i think with integrated pullseq and ackseq it should work.

vzlogger.txt

Try putting the '7E1' in apostrophes. That worked for me. Otherwise the script will cut off something and the definition will be incomplete

@jpfaff
Copy link

jpfaff commented Sep 10, 2021

Hi @dAjaY85
I created a fork where I was testing a setup with parameters that are not yet integrated into the addon.
It replaces all parameters with one single string parameter.
I tested it with:
{"enabled": true, "allowskip": false, "interval": -1, "aggtime": -1, "aggfixedinterval": false, "channels": [{"api": "null", "uuid": "1", "identifier": "1.8.0", "aggmode": "none", "duplicates": 0}], "protocol": "d0", "device": "/dev/ttyUSB0", "pullseq": "2F3F210D0A", "ackseq": "auto", "baudrate": 300, "parity": "7e1"}
and
{"enabled": true,"interval": 10,"max": 40.0,"min": -5.0,"channels": [{"api": "null","identifier": "1","uuid": "1",}],"protocol": "random"}
and it seems to work fine.
One can use it to test the settings before asking for integration here. Drawback: you have to add it manually (copy the vzlogger2mqtt folder into your HA addons folder)

@m-reuter
Copy link
Owner

Very likely it thinks 7e1 is a number rather than a string without apostrophes. About additional parameters, I think it will be very easy to integrate more in the future. So, everyone, just post here if anything is needed (or generate your own pull request :)

@m-reuter m-reuter changed the title Add support for more configuration values vzlogger - Add support for more configuration values Sep 12, 2021
@Din-BH
Copy link

Din-BH commented Sep 14, 2022

Hi @m-reuter. Appreciate your work, have been using vzlogger for a few months! I have a recurring issue that I believe would be possible to fix with an additional optional config parameter, namely "allowskip".

My issue is that my d0 device seems to be shifting between /dev/ttyUSB0 and /dev/ttyUSB1 over time. When the device shifts, vzlogger cannot find it, and I lose my logging. A simple (albeit not very elegant) way to fix that issue would be to make both ports meters, and simply mark both as "allowskip: true".

@jpfaff
Copy link

jpfaff commented Sep 14, 2022

@Din-BH you can check if you find your serial device in /dev/serial/by-id and reference to it through that instead of ttyUSBX which references to the same thing at the end.
By-id will only change when you change the physical device.

@m-reuter
Copy link
Owner

Wow @jpfaff you are fast, I was just typing that response. It would be best to fix the problem there.

@Din-BH
Copy link

Din-BH commented Sep 14, 2022

Thanks guys, I will check that out! Sounds like a much more elegant solution ;)

@Din-BH
Copy link

Din-BH commented Sep 14, 2022

At least initially it seems like it is indeed working! Withdrawing my request for new config parameter ;)

@m-reuter
Copy link
Owner

I added a recommendation to use the device id instead of ttyUSB in the README 06aaf4a

@raymanP
Copy link

raymanP commented Sep 18, 2022

HI @m-reuter, the add on is a really good start to integrate vzlogger. Thank you for that initiative!

I am observing the following problem (verbose = 15):

[Sep 18 05:14:57][mtr0] Got 2 new readings from meter:
[Sep 18 05:14:57][mtr0] Reading: id=1-0:1.8.0*255/ObisIdentifier:1-0:1.8.0*255 value=111000.00 ts=5237894000
[Sep 18 05:14:57][mtr0] Reading: id=1-0:2.8.0*255/ObisIdentifier:1-0:2.8.0*255 value=138000.00 ts=5237894000
[Sep 18 05:14:57][mtr0] meter returned readings with a timestamp before 1990, IGNORING.
[Sep 18 05:14:57][mtr0] most likely your meter is misconfigured,
[Sep 18 05:14:57][mtr0] for sml meters, set `"use_local_time": true` in vzlogger.conf (meter section),
[Sep 18 05:14:57][mtr0] to override this check, set `"i_have_a_time_machine": true` in vzlogger.conf.

The energy meter has been installed several weeks ago.
Is it possible to add the i_have_a_time_machine option?

Or maybe better as I think it was already proposed, to be able to alternatively enter a full custom vzlogger.conf content and also to get a copy of the generated config so it can be pasted into the custom config and adapted as needed. :)

@m-reuter
Copy link
Owner

Hi @raymanP , in the newest version you can set use_local_time to true. It will then use the time from your computer instead of the one from the meter which is incorrect. See #11 .

We can also add the i_have_a_time_machine option of course, but I see no real reason as that would mean you trust the incorrect time values from your meter. Let me know if you think there is a good reason for adding it.

The vzlogger.conf that is created in the add-on gets printed to the log, so you can see it. But you cannot change it. Sadly that is only possible via the config interface for the variables that we have enabled. We could have a free-text option, but that is not straight forward. Also it would be unclear if that is a free text to be added to a specific meter setting or general setting etc. So I see no easy way to do that. If anyone has an idea feel free to contribute.

@raymanP
Copy link

raymanP commented Sep 18, 2022

Hi @m-reuter, this is really fast fast response :))
I use already the newest version 0.9.5 with use_local_time set to true. I would also expect not to get that message with this setting. I could not find any documentation of the i_have_a_time_machine parameter for vzlogger.
Also changing the use_local_time to false gave the same response from vzlogger. As I understand the message, the i_have_a_time_machine just disables the checking of the time stamp but not really sure...

Additionally, vzlogger.conf printed in the log is not visible, as the log size is so small, that the logs afterwards move the config out of the log. Is there an option to increase the log size in the addons?

@raymanP
Copy link

raymanP commented Sep 18, 2022

If figured out how to increase log size: https://www.home-assistant.io/integrations/system_log/
Also what is stange, I disabled and enabled the use_local_time and remove the meter1_device leading first to smllib errors and then added back the meter1_device, still leading to the errors. After another restart of the addon, the addon is working and not giving the respective message. So maybe something went wrong with the update of the addon and the config. Before the addon update I even could not access the device, however this could have been fixed by latest hassos updates.

@m-reuter
Copy link
Owner

Hi @raymanP , so it is working for you now after update and restart. That's great. Not sure what exactly caused the hiccup. Usually after an update the config will be adjusted and everything works directly (at least for me for the recent updates). Anyway good to hear it is working now.

@raymanP
Copy link

raymanP commented Sep 18, 2022

Thank you very much for assisting @m-reuter !! :))

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