muppet3000 / homeassistant-grott

Home Assistant Integration for Grott - MQTT
MIT License
65 stars 14 forks source link

state_class: total_increasing #16

Closed Snux closed 12 months ago

Snux commented 1 year ago

For sensors/entities which go back to zero at the start of each day (like export today, generation today etc etc) could you change their state_class from total to total_increasing?

There is some documentation on it here if you're interested :

https://developers.home-assistant.io/docs/core/entity/sensor/

Basically I wanted to try out the standard energy dashboard in HA but it was getting screwed up at midnight when the values dropped back to zero. Using total_increasing tells HA that going back to zero is effectively the start of a new cycle. For the moment I've created template sensors with the new state class but using the values from your integration and that's working fine, but if the base integration could do this I think it would be cleaner. I don't think this would be a breaking change........

muppet3000 commented 1 year ago

Hi @Snux - I've just checked through all of the sensors and they are already correct (I was pretty meticulous when I set this up). You can check this here: https://github.com/muppet3000/homeassistant-grott/blob/main/custom_components/grott/sensors/sensors_mqtt.py

I'm not sure what issue you're having but it's not related to the configurations of the sensors. What are the specific sensors you're having issues with? I'm running this integration myself with the energy dashboard and don't have any issues.

I use the all-time totals rather than the daily totals and that works fine as well.

Snux commented 1 year ago

Well that's kinda odd. Maybe this is related to me briefly having the old (API) integration running at the same time as this one? I picked one of the sensors coming from this integration and it doesn't match your code. Do I need to reload something?

Image 1

muppet3000 commented 1 year ago

That's from the old integration, the new one is this one: https://github.com/muppet3000/homeassistant-grott/blob/main/custom_components/grott/sensors/sensors_mqtt.py#L754-L763

It would be called "Import from Grid Energy - Today"

muppet3000 commented 1 year ago

You can always redownload the integration, the latest version is on the 'main' branch and you can install that. But I'm certain I haven't changed those formats since the initial release.

Snux commented 1 year ago

OK, so now I'm completely confused. Instead of just disabling the old API integration, I've deleted it. And I've redownloaded the new one. All the sensors are still there with the old names, and being updated. This is some of the list that show up in my MQTT list....

Image 2

muppet3000 commented 1 year ago

Did you add template sensors to replicate the old names at some point? I can't explain why the old ones are still there, especially if they're being called 'MQTT'. Do any of the new names appear at all? e.g. the one I sent you earlier?

Snux commented 1 year ago

No, the only template sensors I have in this area are where I wanted to add 2 together. "Import from Grid Energy - Today" doesn't show at all. I know I've got the right integration as I can see your code in my custom components folder. So how are the sensors above getting updated? I need a lie down :)

muppet3000 commented 1 year ago

You've restarted HA right? (I assume you have but I'm at a loss myself). I cannot explain how the sensors are being updated if we've got no integrations pushing data to those sensors! That's just craziness!!! I can't understand how the ones with 'today' in the title don't appear. Can you help me out and send a screengrab of the 'device' itself in HA (steps below): Settings -> Devices & Services -> Grott (X devices): image

Does the correct name show in the 'sensors' list there: image

You can hover over the names to get the full names.

Snux commented 1 year ago

It gets weirder......
Image 3

I configured with just the + in there to autodetect.

Snux commented 1 year ago

All of my sensors show under MQTT, not under Grott.... Image 4

muppet3000 commented 1 year ago

Are you running grott using the egguy add-on? Perhaps the two of them are conflicting with each other in some way? Maybe the egguy one also adds these metrics and that explains the odd behaviour. The reason nothing would be picked up by my integration is if you've changed (or the add-on has) the default topic used. The topic that it's expecting is the default that grott uses: energy/growatt

Snux commented 1 year ago

Bingo. Yes, I'm using the addon from egguy (was easier to setup). I thought though it was just going to do grott and push stuff at MQTT, but it's actually building all the sensors too. So actually I'm not running your integration at all.

You can see all the sensors in the add on here....

https://raw.githubusercontent.com/egguy/grott/feature/ha-extension/examples/Home%20Assistent/grott_ha.py

Now I'm trying to work out what to do next....

muppet3000 commented 1 year ago

How comfortable are you with tweaking some of the code in the custom_components directory? I reckon we can make both work simultaneously as a hack for now, if you're willing to be a guinea pig for me?

Snux commented 1 year ago

Happy to give it a shot (let me just grab a backup first!).

Ideally I'd just like to use his addon for the grott -> mqtt part as that was remarkably simple to setup.

muppet3000 commented 1 year ago

So I think this line: https://github.com/muppet3000/homeassistant-grott/blob/main/custom_components/grott/sensor.py#L96 is the killer line in my integration that isn't picking up anything published because the egguy addon doesn't use the default configuration for the MQTT topics.

Instead, it looks like it's using this: https://github.com/egguy/grott/blob/feature/ha-extension/examples/Home%20Assistent/grott_ha.py#L49

So, my suggestion, is, look in the custom compoents directory and edit my sensor.py file, the path should be: custom_components/grott/sensor.py

Change energy/growatt/# to say homeassistant/grott/# instead.

I'm not 100% certain whether this will work, but I think it might. I'm trying to understand a little bit about how that add-on works, however I'm at work and it's a bit difficult to do this as well :P

Snux commented 1 year ago

It's OK, I'm at work too :) We can do this piecemeal as you get time, no hurry.

You're in the right area. I made the change and switched on your debug logging and get this now...

2023-06-12 14:47:23.270 DEBUG (MainThread) [custom_components.grott.sensor] Received message: homeassistant/grott/NWCTCHL050/state
2023-06-12 14:47:23.270 DEBUG (MainThread) [custom_components.grott.sensor] Payload: {'datalogserial': 'JPC8CHM04K', 'pvserial': 'NWCTCHL050', 'pvstatus': 5, 'pvpowerin': 17000, 'pv1voltage': 2551, 'pv1current': 28, 'pv1watt': 7194, 'pv2voltage': 3230, 'pv2current': 30, 'pv2watt': 9885, 'pvpowerout': 16258, 'pvfrequentie': 5000, 'pvgridvoltage': 2488, 'pvgridcurrent': 65, 'pvgridpower': 16327, 'pvgridvoltage2': 0, 'pvgridcurrent2': 0, 'pvgridpower2': 0, 'pvgridvoltage3': 0, 'pvgridcurrent3': 0, 'pvgridpower3': 0, 'totworktime': 34692578, 'eactoday': 181, 'pvenergytoday': 181, 'eactotal': 27556, 'epvtotal': 29351, 'epv1today': 125, 'epv1total': 12669, 'epv2today': 90, 'epv2total': 16561, 'pvtemperature': 546, 'pvipmtemperature': 490, 'pvboosttemp': 568, 'bat_dsp': 530, 'eacharge_today': 1, 'eacharge_total': 1838, 'batterytype': 1, 'uwsysworkmode': 5, 'systemfaultword0': 0, 'systemfaultword1': 0, 'systemfaultword2': 0, 'systemfaultword3': 0, 'systemfaultword4': 0, 'systemfaultword5': 0, 'systemfaultword6': 0, 'systemfaultword7': 256, 'pdischarge1': 0, 'p1charge1': 0, 'vbat': 532, 'SOC': 95, 'pactouserr': 0, 'pactousertot': 0, 'pactogridr': 10880, 'pactogridtot': 10880, 'plocaloadr': 6200, 'plocaloadtot': 6200, 'spdspstatus': 5, 'spbusvolt': 3011, 'etouser_tod': 2, 'etouser_tot': 14965, 'etogrid_tod': 104, 'etogrid_tot': 11279, 'edischarge1_tod': 25, 'edischarge1_tot': 7349, 'eharge1_tod': 50, 'eharge1_tot': 8168, 'elocalload_tod': 89, 'elocalload_tot': 32218, 'grott_last_push': '2023-06-12T13:46:22.835725+00:00'}
2023-06-12 14:47:23.270 DEBUG (MainThread) [custom_components.grott.sensor] Configured to look for device: + (+ means all)
2023-06-12 14:47:23.270 DEBUG (MainThread) [custom_components.grott.sensor] Configured to include calculated values: True
2023-06-12 14:47:23.296 ERROR (MainThread) [homeassistant.util.logging] Exception in mqtt_message_received when handling msg on 'homeassistant/grott/NWCTCHL050/state': '{"datalogserial": "JPC8CHM04K", "pvserial": "NWCTCHL050", "pvstatus": 5, "pvpowerin": 17000, "pv1voltage": 2551, "pv1current": 28, "pv1watt": 7194, "pv2voltage": 3230, "pv2current": 30, "pv2watt": 9885, "pvpowerout": 16258, "pvfrequentie": 5000, "pvgridvoltage": 2488, "pvgridcurrent": 65, "pvgridpower": 16327, "pvgridvoltage2": 0, "pvgridcurrent2": 0, "pvgridpower2": 0, "pvgridvoltage3": 0, "pvgridcurrent3": 0, "pvgridpower3": 0, "totworktime": 34692578, "eactoday": 181, "pvenergytoday": 181, "eactotal": 27556, "epvtotal": 29351, "epv1today": 125, "epv1total": 12669, "epv2today": 90, "epv2total": 16561, "pvtemperature": 546, "pvipmtemperature": 490, "pvboosttemp": 568, "bat_dsp": 530, "eacharge_today": 1, "eacharge_total": 1838, "batterytype": 1, "uwsysworkmode": 5, "systemfaultword0": 0, "systemfaultword1": 0, "systemfaultword2": 0, "systemfaultword3": 0, "systemfaultword4": 0, "systemfaultword5": 0, "systemfaultword6": 0, "systemfaultword7": 256, "pdischarge1": 0, "p1charge1": 0, "vbat": 532, "SOC": 95, "pactouserr": 0, "pactousertot": 0, "pactogridr": 10880, "pactogridtot": 10880, "plocaloadr": 6200, "plocaloadtot": 6200, "spdspstatus": 5, "spbusvolt": 3011, "etouser_tod": 2, "etouser_tot": 14965, "etogrid_tod": 104, "etogrid_tot": 11279, "edischarge1_tod": 25, "edischarge1_tot": 7349, "eharge1_tod": 50, "eharge1_tot": 8168, "elocalload_tod": 89, "elocalload_tot": 32218, "grott_last_push": "2023-06-12T13:46:22.835725+00:00"}'
Traceback (most recent call last):
  File "/config/custom_components/grott/sensor.py", line 67, in mqtt_message_received
    device_id = payload["device"]
                ~~~~~~~^^^^^^^^^^
KeyError: 'device'
muppet3000 commented 1 year ago

Sounds like we're both having a super productive day at work :)

That debug printout is much more helpful than you'd realise, the topic is completely different for the HA add-on in that case.

For now, revert it back to how it was (so your logs aren't filled with errors from my integration) and let me think it over. With a bit of thought I think we can make it so that we can handle both scenarios so that people that want to use the egguy add-on can without too much difficulty (as you say, it makes the setup nice and easy).

I'll produce a feature branch or something (or maybe just a file you can copy in to place) to do some testing for me with it so we can make sure it works in both scenarios. It's a shame I've got no way of running a version of HA that supports the 'add-on' method, otherwise I'd have tested it myself.

I need to spend a bit of time getting my head around how the egguy addon actually works, it feels like it's doing about 20 different things:

Snux commented 1 year ago

Sounds like a plan, I reverted the change.

I never realised his addon did so much. I installed MQTT, then his add on, then your integration pretty much at the same time so when I got a bunch of new sensors I just assumed they were yours :)

muppet3000 commented 1 year ago

Are you using the Home Assistant MQTT add-on i.e. the one that runs MQTT as part of home assistant?

Snux commented 1 year ago

Yup, went in like a dream and the egguy addon connected first time. I used that as a complete noob doing anything outside of HA. Image 6

muppet3000 commented 1 year ago

Hi @Snux

I was planning on looking at this last night, but the heat here in the UK completely wiped me out! My brain just wasn't up to it.

Can I ask what instructions you followed to set up the egguy add-on?

I've found these ones: https://github.com/egguy/grott/tree/feature/ha-extension/examples/Home%20Assistent based on the link you sent yesterday, but it doesn't explain or show how to run grott. Are you running grott manually??

I don't see anywhere in the instructions where it tells you to copy in grott or anything like that, it tells you to modify a grott.ini file though. I'm a little bit confused (maybe it's my brain still catching up from yesterday :P).

Alternatively, have I got my wires crossed and you're actually using this one: https://github.com/egguy/grott-home-assistant-add-on ???? If you're using that one it makes a whole lot more sense and I reckon we could probably tweak that setup slightly and both of them will work.

Snux commented 1 year ago

No worries, I’m in the UK too (sunny Kent) and my home office faces south, so I know the problem 😊

It is indeed this one…

https://github.com/egguy/grott-home-assistant-add-on

From: Chris Straffon @.> Sent: Tuesday, June 13, 2023 9:29 AM To: muppet3000/homeassistant-grott @.> Cc: marks sunnucks.com @.>; Mention @.> Subject: Re: [muppet3000/homeassistant-grott] state_class: total_increasing (Issue #16)

Hi @Snuxhttps://github.com/Snux

I was planning on looking at this last night, but the heat here in the UK completely wiped me out! My brain just wasn't up to it.

Can I ask what instructions you followed to set up the egguy add-on?

I've found these ones: https://github.com/egguy/grott/tree/feature/ha-extension/examples/Home%20Assistent based on the link you sent yesterday, but it doesn't explain or show how to run grott. Are you running grott manually??

I don't see anywhere in the instructions where it tells you to copy in grott or anything like that, it tells you to modify a grott.ini file though. I'm a little bit confused (maybe it's my brain still catching up from yesterday :P).

Alternatively, have I got my wires crossed and you're actually using this one: https://github.com/egguy/grott-home-assistant-add-on ???? If you're using that one it makes a whole lot more sense and I reckon we could probably tweak that setup slightly and both of them will work.

— Reply to this email directly, view it on GitHubhttps://github.com/muppet3000/homeassistant-grott/issues/16#issuecomment-1588809604, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEYFKUW62233THYHYSOR3TXLAQE5ANCNFSM6AAAAAAZDCNCE4. You are receiving this because you were mentioned.Message ID: @.***>

muppet3000 commented 1 year ago

No worries, I’m in the UK too (sunny Kent) and my home office faces south, so I know the problem 😊 It is indeed this one… https://github.com/egguy/grott-home-assistant-add-on From: Chris Straffon @.> Sent: Tuesday, June 13, 2023 9:29 AM To: muppet3000/homeassistant-grott @.> Cc: marks sunnucks.com @.>; Mention @.> Subject: Re: [muppet3000/homeassistant-grott] state_class: total_increasing (Issue #16) Hi @Snuxhttps://github.com/Snux I was planning on looking at this last night, but the heat here in the UK completely wiped me out! My brain just wasn't up to it. Can I ask what instructions you followed to set up the egguy add-on? I've found these ones: https://github.com/egguy/grott/tree/feature/ha-extension/examples/Home%20Assistent based on the link you sent yesterday, but it doesn't explain or show how to run grott. Are you running grott manually?? I don't see anywhere in the instructions where it tells you to copy in grott or anything like that, it tells you to modify a grott.ini file though. I'm a little bit confused (maybe it's my brain still catching up from yesterday :P). Alternatively, have I got my wires crossed and you're actually using this one: https://github.com/egguy/grott-home-assistant-add-on ???? If you're using that one it makes a whole lot more sense and I reckon we could probably tweak that setup slightly and both of them will work. — Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEYFKUW62233THYHYSOR3TXLAQE5ANCNFSM6AAAAAAZDCNCE4. You are receiving this because you were mentioned.Message ID: @.***>

Cool. I normally love the warm weather, but for some reason it wiped me out the last couple of days.

Now I know what version of the add-on you're using I'll do a bit more research and try to understand better what it's doing and how it works. I reckon there's a few things we can do to make it work, possibly even without affecting the egguy add-on.

muppet3000 commented 1 year ago

I've been looking at this in the background today. I've got to a better point of understanding, however this would be sooooo much easier if I had a version of HomeAssistant the supported installing add-ons. I could properly test it then. Short version:

Slightly longer version:

In my opinion, now that my Integration exists all that the add-on needs to do is to run the stock grott image and use it to push things straight to mqtt. The problem I have is whether or not the MQTT broker running in HA can be referred to as 'localhost' or not.

The reason all the data is in a different format is because the home assistant add-on/plugin for Grott changes the format of the data so that it's different to what it's native MQTT implementation does - which is really weird IMO.

Anyway, I'm looking at whether there's a nice way for me to spin up the add-on version of home-assistant in a VM so that I can test my theory and then suggest a new course of action.

muppet3000 commented 1 year ago

More notes for myself - worked out how to spin up a HomeAssistant OS VM - https://www.home-assistant.io/installation/linux

Will attempt to spin one up tonight and have a play with it. Unlikely to get to the point of Grott running, but if I can get the OS up and running that'll be a good result.

Will also try to work through some of the other issues in the backlog for my integration to make space for working on this.

Snux commented 1 year ago

So, I think it might be simpler than this. I looked at the config for the addon and ended up poking around the grott code a bit (yuck - I hate python, I'm too old school). We might just need to raise an issue for a bug on the addon.

In the config is this little item....

Image 1

Following that through, it gets sent into grott as the nomqtt parameter. If this is set to True, grott should skip sending the normal MQTT messages. If false, it should send as normal (which I think your integration would then pick up).

I switched on the verbose log from the addon and set the above parm to keep the original grott messages. The below is what popped up in the log

     **- Grott MQTT topic used : energy/growatt
     - MQTT send failed: [Errno 99] Address not available
     - Grott Send data to PVOutput disabled 
     - Grott Send data to Influx disabled 
     - Grott extension processing started :  grott_ha
    Grott HA 0.0.7-RC8 - creating NWCTCHL050 config in HA, 69 to push
    Pushing 70 configurations payload to HA
    Configurations pushed**

So you can see it's trying to send using the topic you're expecting, but failing with that error 99. Then the addon kicks in and sorts out all it's messages.

So I think before you spend all that time getting a new HA setup, why don't I raise an issue against the addon asking for this option to be fixed?

Snux commented 1 year ago

Bingo. Fixed it.

When trying to do the regular grott MQTT messages, it's reading the grott.ini file to get the connection information (which the addon has somewhere else). That file by default is empty, so I just populated the mqtt section and we're up and running....

Image 2

muppet3000 commented 1 year ago

So that's what I wanted to change in the add-on i.e. the configuration information for where mqtt is. Were you able to change that grott.ini file then? I couldn't work out how that worked hence why I wanted to install the HA OS to test it myself. I still think there's room for improvement in terms of giving people the flexibility to choose how they want to run it, it seems excessive to have all the same sensors appearing twice. I'd like to distribute a paired down version of the add-on that just allows for the running of Grott using the default method to push to MQTT and then use my integration to display the info.

If we could leave this ticket open to allow me to investigate that would be great, rather than closing it just because we've got a work-around.

Could you let me know where you found the ini file and what you set the host of the mqtt host to? I was wondering if you could get away with using localhost.

Really glad it's working now, even if it's a bit hacky. Let me know any feedback on the integration itself when you get the chance.

Snux commented 1 year ago

This screenshot shows where the grott.ini is (when installing the addon it creates the file but leaves it empty)

Image 3

I tried with localhost but got the 'address not available' error.

I tried to disable the add-on (it's a section called [Extension] in the grott.ini) but the script running it over-rides it. Changing this line in the add-on package to "False" would stop grott from calling it, but would let it still call the normal MQTT publish.

https://github.com/egguy/grott-home-assistant-add-on/blob/main/grott-current/script.sh#L68

muppet3000 commented 1 year ago

@Snux - Can you confirm how you're running home assistant OS? I'm trying to work out how you've managed to get access to the filesystem that it's running, have you ssh'd into the VM or something like that? When you have Home Assistant OS running you just have the ha command line which is about as useful as a chocolate teapot (for anyone that know what they're doing).

Just curious how you're poking around on the file system that's all. (I can probably work it out with SSH and some plugin or something, but I'm looking for the shortcut).

muppet3000 commented 1 year ago

I've got HA OS running and the grott add-on installed. I think I understand how it all pieces together and I'm tempted to fork the egguy add-on and try and get it to simply start grott and push the relevant info to MQTT. I don't think it'll be that hard, I just don't have the mental capacity for it right now!

In my opinion it'll be a whole lot cleaner if people can just run Grott and MQTT as add-ons and then use the stand-alone integration to present the data, division of responsibilities etc. etc. The grott add-on is adding an unnecessary additional layer of additional complexity in my opinion considering all that needs to happen is for Grott to publish to MQTT - which it does out of the box anyway!!!

muppet3000 commented 1 year ago

Now I've slept on it, I think the add-on to just run grott is actually really simple. I'm going to have a crack at it tonight. However, since you have a workaround for now (albeit hacky) I may focus on some of the other bugs/items that have been hanging around instead. I'll keep you posted, but we'll keep this issue open until I've had the chance to throw together an alternative add-on that just does the running of Grott, pushing to the local MQTT.

Snux commented 1 year ago

I'm trying to work out how you've managed to get access to the filesystem that it's running, have you ssh'd into the VM or something like that? When you have Home Assistant OS running you just have the ha command line which is about as useful as a chocolate teapot (for anyone that know what they're doing).

I'm running HAOS on a regular RPi4. There are file editor addons (a simple one, plus full VSCode) which let you open and edit files directly inside HA. Seemingly only within the config folder of HA, but that's all I need it for. Works fine.

I'll keep you posted, but we'll keep this issue open until I've had the chance to throw together an alternative add-on that just does the running of Grott, pushing to the local MQTT.

Sounds good - no hurry from my side at all, I need to work through my setup switching the sensors over now. Maybe we should rename the issue though as it doesn't actually reflect the cause.

muppet3000 commented 1 year ago

Thanks, for the info. I'll rename the ticket tonight when I'm doing admin. If you haven't already seen it, I wrote a load of template examples for people wanting to switch from the growatt-api integration to this one so you could keep all the old sensor names: https://github.com/muppet3000/homeassistant-grott/blob/main/examples/templates/template_configuration.yaml

Snux commented 1 year ago

I wrote a load of template examples for people wanting to switch from the growatt-api integration to this one so you could keep all the old sensor names

I did see that, but I have such a mess of sensors at the moment (and not just in the growatt area) that I thinking starting afresh is probably a good idea!

muppet3000 commented 1 year ago

I've started work on a paired down version of the egguy addon, however I'm away for the weekend and I've just realised the HA-OS setup I made the other day at home isn't accessible from where I am, so I'll have to wait to test it.

There's no way that I'll get it correct first time so I'll wait until I'm back tomorrow before sharing it (after I've given it a quick test). My intention is to make it just run grott & push the data to mqtt then the integration from this repo will do all the sensor creation etc. I'll speak to Egguy about whether he wants to replace it entirely or whether I should just run a fork of it for people.

xhemp commented 1 year ago

Just for completeness from the other issue I opened:

I managed to go through anything I had on my configuration.yaml and then the mqtt devices with growatt or coming from egguy's plugin, deleted them all, restarted HA and managed to get it all working (battery/charge/discharge on the energy dashboard working fine). Just saw a warning on hass logs:

2023-06-17 17:30:27.017 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.wpdacf6049_self_consumption_solar_battery_energy_today_eactoday from integration grott has state class total_increasing, but its state is not strictly increasing. Triggered by state 1.9 (2.0) with last_updated set to 2023-06-17T16:25:54.939193+00:00. Please report it to the custom integration author.

2023-06-17 17:30:27.044 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.wpdacf6049_battery_charged_energy_today from integration grott has state class total_increasing, but its state is not strictly increasing. Triggered by state 5.9 (6.0) with last_updated set to 2023-06-17T16:25:54.948572+00:00. Please report it to the custom integration author.

No biggie, though. Thanks for the help @muppet3000 !

muppet3000 commented 1 year ago

Hi Guys,

If you guys are able to stumble on with the hacked config for now, I've realised I've had some long standing issues that I promised I'd fix for people. Then next on my list is deprecating the old Growatt API add-on from HA-Core

Then it's this one - I want to have a proper chat with egguy to make sure I'm not treading on his toes.

egguy commented 1 year ago

Hi, I was looking to make the add-on a lot easier to use with your integration. @muppet3000 Will having a toggle to disable the grott_ha extension and just configuring the base MQTT push would be useful? I can also, not configure the sensor and just push on homeassistant/grott//state the values.

I tried with localhost but got the 'address not available' error.

One of the things to note, the add-on is running in its own networking space and the MQTT server in another. If you put localhost, its refers to the grott add-on address. The mosquito's add-on server address is : core-mosquitto is in the ip section. It should look like: ip= core-mosquitto

PS: Just added a way to disable the HA extension and enable the MQTT output in the edge HA add-on. I've done some tests with the HACS integration, and it works well, but I would love some more feedback.

Snux commented 1 year ago

@egguy @muppet3000 with the latest edge HA add-on with disable/enable set for the extension/MQTT it's working really well. I'm only missing one sensor, I think it sits in the HA add-on still, but is now disabled. Can you possibly bring back the "Grott last data push" sensor, even if the HA extension is disabled. It's a really quick way to determine if we're updating or not and if there is some issue at the Growatt side.

muppet3000 commented 1 year ago

Sorry I've been out of touch for a couple of weeks guys I've been really busy with non computery stuff while the weather has been so nice here in the UK.

So can I make sure I understand this correctly as there are a few things going on here:

  1. @egguy - You've released a new version of the add-on that allows people to disable the grott_ha extension and instead just push the values to MQTT instead. If that's correct I'll update my "how-to" instructions for how to configure this
  2. @Snux - You've tested the new add-on and it's working nicely?
  3. @Snux - You'd like an additional sensor to be added (that probably only existed in the grott_ha extension) that states when the last update to MQTT was published - note - it's possible to get the last updated time of a particular sensor in HA, but I agree it's really handy to have it called out as a specific value.

As a side note with regards to seeing if there are issues on the growatt side of things - I'm going to have a look at the grott code at some point and try and implement some logic that allows people to optionally choose to use the 'stubbed' version of grottproxy when growatt isn't responding so that MQTT values will still update, then when grott becomes available again it will switch back to that method. Right now though I'm focussed on identifying and fixing as many bugs as possible in this integration as the priority.

muppet3000 commented 1 year ago

With regards to (3) above. I've just made a push to the main branch that reads the value in the MQTT message called time and publishes it as a value called Last data update, it will appear in the diagnostics section of the Grott Device as a timestamp.

NOTE: This requires Grott to be pushing the date/time info correctly, for my SPH system it's not provided in the packets so Grott adds it on it's own. Therefore you have to make sure that grott is running with the correct timezone, by default in a docker container that's UTC, so you need to change the timezone using an environment variable to whatever your local timezone is. If you need help with that part just let me know.

Snux commented 1 year ago

Works a treat. I've just got a regular HA install on my RPi, so the timezone is all good :) Thanks!

muppet3000 commented 1 year ago

@Snux - Thanks for the confirmation Are you able to confirm whether you're using the latest version of @egguy 's add-on that allows 'native' MQTT integration and disables the build-in HA integration so you can just use this one instead?

I'm thinking I may close this ticket once I have confirmation and then add a new issue to update the documentation with info on how to use the add-on as an alternative method.

Snux commented 1 year ago

Are you able to confirm whether you're using the latest version of @egguy 's add-on that allows 'native' MQTT integration and disables the build-in HA integration so you can just use this one instead?

Yup, I can indeed confirm that. I'm just using the native Grott -> MQTT from egguy, but with the built in disabled so it's just yours that is supplying my HA sensors.

egguy commented 1 year ago

@muppet3000 Yes, you can have only the native MQTT messages, or both native + HA compatible MQTT.

image

I also need to find time to update the documentation...

muppet3000 commented 12 months ago

I'm going to close this one as part of the next release and open a new ticket to update the documentation for people to use the @egguy add-on if they want to.

muppet3000 commented 12 months ago

Released in v1.1.0