azuwis / zigbee2mqtt-networkmap

Home Assistant Custom Card to show Zigbee2mqtt network map
261 stars 18 forks source link

Feature Request: Option to remove refresh button #36

Closed msp1974 closed 2 years ago

msp1974 commented 2 years ago

I am one of the developers of the Wiser Heating Integration which is a zigbee based network for radiator TRVs, plugs, lights etc controlled by a hub unit.

I have been playing around with this great card to see if I can use it on top of a sensor form the Wiser integration to show the zigbee network map of these devices. Suffice to say, I have got this working without any mods to this card and it is fab!

The one flaw in the plan is the refresh button calls the mqtt service to get the data in the sensor to update. Obviously in this case there is no mqtt invovled. The card does update however with the 1 minute interval update of the sensor.

EDIT: Sorry should have added that because no mqtt involved, you get an error calling the mqtt service

Would it be possible to add a config option to be able to hide the refresh button such that it can be used with a non mqtt sensor/environment?

Thanks - screenshot of it working below

image

azuwis commented 2 years ago

I'm surprised that it works for your project.

This card use data schema from zigbee2mqtt networkmap, raw type, https://www.zigbee2mqtt.io/guide/usage/mqtt_topics_and_messages.html#zigbee2mqtt-bridge-request, AFAIK it's not a standard schema, not even documented.

Your project must be somehow related to zigbee2mqtt.

Removing the refresh button is easy, just remove those lines: https://github.com/azuwis/zigbee2mqtt-networkmap/blob/10e76ebe5f12345c71bd3f563f4b893c8fba3de6/src/components/Zigbee2mqttNetworkmap.vue#L69-L74 https://github.com/azuwis/zigbee2mqtt-networkmap/blob/10e76ebe5f12345c71bd3f563f4b893c8fba3de6/src/components/Zigbee2mqttNetworkmap.vue#L176

and recompile (see https://github.com/azuwis/zigbee2mqtt-networkmap#compiles-and-minifies-for-production).

I suggest you make a fork and modify it for you project, because I don't have the device you mentioned, and can not test any code changes for it.

msp1974 commented 2 years ago

I have just added a new sensor into our integration to mimic the mqtt sensor based on the test data you have in mqtt.js. it updates every minute via the wiser integration to provide the sensor attribute data in the right format.

Rather than create a fork, would you accept a PR if I can work out how to have an option to just disable the refresh button? Apart from this it works perfectly that when the sensor updates, the network map does too. Its just the manual refresh function I would like to be able to disable as that is the bit that calls the mqtt service.

msp1974 commented 2 years ago

Actually, I have worked out that I can just hide it via additional css in the card config. This will be more than fine for this use. Thanks for helping.

Mark