Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.2k stars 1.68k forks source link

[Experimental feature] Webbased frontend #4266

Closed Koenkk closed 3 years ago

Koenkk commented 4 years ago

This experimental feature allows to run a frontend straight from Zigbee2MQTT (so no additional setup is required). This frontend is developed by @nurikk, the source code can be found here: https://github.com/nurikk/z2m-frontend

To enable this, switch to the dev branch and add the following to your configuration.yam.

frontend:
  port: 8080

In case you find any issues in the frontend, report them here: https://github.com/nurikk/z2m-frontend/issues

sjorge commented 4 years ago

Initial impressions using firefox on macOS

The group view is absolutely amazing!

Very promising start!

sjorge commented 4 years ago

The bind tab also no longer show the devices friendly name, the network address is still in the URL though, but would be nice to also have that visible.

scrshot

Westcott1 commented 4 years ago

Does using port 8080 conflict with Domoticz, when it's on the same RPi as Z2M?

nurikk commented 4 years ago

Does using port 8080 conflict with Domoticz, when it's on the same RPi as Z2M?

You can specify any port in configuration

sjorge commented 4 years ago

Sorting is working great, except for the power colomn.

SAOPP commented 4 years ago

Guys, as I understand it, the map is saved only for the current session in the browser?

nurikk commented 4 years ago

Guys, as I understand it, the map is saved only for the current session in the browser?

Yes, refresh page and you lose your data

nurikk commented 4 years ago

Sorting is working great, except for the power colomn.

What wrong with it?

nurikk commented 4 years ago

How do you find this way of showing logs? (only data from bridge/logging is shown)

Screenshot 2020-09-07 at 11 09 34
sjorge commented 4 years ago

It doesn’t do anything.

I would have expected the battery and mains powered one to be grouped together. (Or ideally sort the battery ones on battery level)

~ sjorge

On 7 Sep 2020, at 05:12, John Doe notifications@github.com wrote:

 Sorting is working great, except for the power colomn.

What wrong with it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

SAOPP commented 4 years ago

Interesting... I don't have a logs menu. It's optional menu? And it can be turn on from configuration?

nurikk commented 4 years ago

Interesting... I don't have a logs menu. It's optional menu? And it can be turn on from configuration?

it's sneak peek from my dev environment, stay tuned :)

nurikk commented 4 years ago

It doesn’t do anything. I would have expected the battery and mains powered one to be grouped together. (Or ideally sort the battery ones on battery level) ~ sjorge On 7 Sep 2020, at 05:12, John Doe @.***> wrote:  Sorting is working great, except for the power colomn. What wrong with it? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

You should update dependencies, yesterday I've released update. It adds sorting by battery level

Screenshot 2020-09-07 at 13 45 11
nurikk commented 4 years ago

Also upcoming touchlink page

Screenshot 2020-09-07 at 14 40 41
sjorge commented 4 years ago

Also upcoming touchlink page

Screenshot 2020-09-07 at 14 40 41

Oh how do you get the devices it detected? I was not aware z2m exposed that information, well i guess if you open the network for joining before doing the request you could see which ones publish a deviceJoined event.

nurikk commented 4 years ago

Also upcoming touchlink page

Screenshot 2020-09-07 at 14 40 41

Oh how do you get the devices it detected? I was not aware z2m exposed that information, well i guess if you open the network for joining before doing the request you could see which ones publish a deviceJoined event.

This feature yet to be implemented, but in general it's just splitting this code and exposing via z2m https://github.com/Koenkk/zigbee-herdsman/blob/33d13a2fba4cc306d11398bf608293c2a6c7aa63/src/controller/touchlink.ts#L16

sjorge commented 4 years ago

So after some changes it could be publish under the zigbee2mqtt/bridge/config/touchlink/+ topic, that be nice.

sjorge commented 4 years ago

@nurikk Given I have a large network map, would you be interested in the the output? real output to work off or create tests from is always useful IMHO.

netweaver1970 commented 4 years ago

very nice work! Any chance of having a linkable/proxyable config page from within HomeAssistant to get to the new Z2M GUI? I have Z2M, letsencrypt(incl NGINX rev. proxy) in separate containers so maybe an HA ingress based solution is needed? I prefer not to open up another endpoint straight via the NGINX reverse proxy, as the page doesn't have authentication. So using the authentication of HA would be nice/enough.

netweaver1970 commented 4 years ago

I might have missed it but is there already an interface for binding/unbinding remotes to groups? That part of Z2M can also use some GUI love.

sjorge commented 4 years ago

Yes! If you view the remote’s details there is a binds tab, works pretty well.

~ sjorge

On 7 Sep 2020, at 17:10, netweaver1970 notifications@github.com wrote:

 I might have missed it but is there already an interface for binding/unbinding remotes to groups? That part of Z2M can also use some GUI love.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

nurikk commented 4 years ago

I've published next release of frontend. Mostly bug fixes

https://github.com/nurikk/z2m-frontend/blob/master/CHANGELOG.md#0148-2020-09-08

nurikk commented 4 years ago

@nurikk Given I have a large network map, would you be interested in the the output? real output to work off or create tests from is always useful IMHO.

Yes, please! you can send me contents of bridge/response/networkmap (raw) ?

sjorge commented 4 years ago

@nurikk Given I have a large network map, would you be interested in the the output? real output to work off or create tests from is always useful IMHO.

Yes, please! you can send me contents of bridge/response/networkmap (raw) ?

https://gist.github.com/sjorge/332f92e691a2475590bdebaf7501b0d6

sjorge commented 4 years ago

Been playing with the latest release, touchlink doesn't seem to work but I think it's missing the above mentioned changes to z2m.

For the logs page: logs

on the devices page

on map page

netweaver1970 commented 4 years ago

Yes! If you view the remote’s details there is a binds tab, works pretty well. ~ sjorge On 7 Sep 2020, at 17:10, netweaver1970 @.***> wrote:  I might have missed it but is there already an interface for binding/unbinding remotes to groups? That part of Z2M can also use some GUI love.

I made a new group with a single IKEA bulb (LED1732G11), that seems to work nicely. But when trying to bind a Lumi/Aqara/Opple/Xiaomi WXKG06LM 1-gang wall switch to that new group, I'm not getting the OnOff cluster to select for binding. I'm only getting these ones : genBasic, genGroups, genIdentify, Scenes, genOta, genMultistateInput. Which one can be used to simply toggle the lightbulb? Or doesn't this switch allow direct binding?

Thanks.

nurikk commented 4 years ago

icons still show 100% while most devices are between 85-50% battery left

Hi, @sjorge ! Can you please send me your bridge/devices and bridge/+ (device statuses) dumps?

sjorge commented 4 years ago

icons still show 100% while most devices are between 85-50% battery left

Hi, @sjorge ! Can you please send me your bridge/devices and bridge/+ (device statuses) dumps?

I've updated the previous gist, not sure what oyu mean with device statuses dump though?

nurikk commented 4 years ago

icons still show 100% while most devices are between 85-50% battery left

Hi, @sjorge ! Can you please send me your bridge/devices and bridge/+ (device statuses) dumps?

I've updated the previous gist, not sure what oyu mean with device statuses dump though?

Everything that post into zigbee2mqtt/+ Example: zigbee2mqtt/0xabababababaab

sjorge commented 4 years ago

Everything that post into zigbee2mqtt/+ Example: zigbee2mqtt/0xabababababaab

Thats a whole lot of data/topics to dump, any device in particular you need? I could dump it all with mosquitto_sub -t zibgee2mqtt/+ but then it won't have the topics linked to it.

nurikk commented 4 years ago

Everything that post into zigbee2mqtt/+ Example: zigbee2mqtt/0xabababababaab

Thats a whole lot of data/topics to dump, any device in particular you need? I could dump it all with mosquitto_sub -t zibgee2mqtt/+ but then it won't have the topics linked to it.

You can use mosquitto_sub with -F flag, to output topic + payload https://mosquitto.org/man/mosquitto_sub-1.html#outputformat

sjorge commented 4 years ago

https://gist.github.com/sjorge/ec2fde7d03ad518e6d72f4fa15549b5d

nurikk commented 4 years ago

https://gist.github.com/sjorge/ec2fde7d03ad518e6d72f4fa15549b5d

Oh, I see now. Didn't expect that someone will use / in friendly name

sjorge commented 4 years ago

<room>/<device> or <room>/<group>/<device>

Makes it easy to get everything for a room or group.

nurikk commented 4 years ago
/ or // Makes it easy to get everything for a room or group. ~ sjorge […](#)

Yes, nice convention. Might start using it at my home:)

nurikk commented 4 years ago

hi, @sjorge I just released version 0.1.52 can you try to update dependencies and check sorting?

Also I've added implementations for touchlink scan/reset calls (identify still pending)

sjorge commented 4 years ago

Sorting on power now works! And LQI too, it even updates! screenshot

Maybe hide the last_seen colomn if we know it's not configured, which we do as the configuration page reflects that.

nurikk commented 4 years ago

I have update frontend version, kindly update dependencies to continue testing

https://github.com/nurikk/z2m-frontend/blob/master/CHANGELOG.md

sjorge commented 4 years ago

using the new touchlink stuff, if you identify a bulb and the immediately try to factory reset it, the command gives a timeout because the bulb still seems to be in the 'identifying' phase.

Maybe disable factory reset button for a few seconds to make sure the identify has finished.

JasonSwindle commented 4 years ago

My devices are missing icons or all white, and make the map harder to read. I wish I had ghost devices. :)

image

sjorge commented 4 years ago

Also 2x clicking on the scan button crashes the coordinator with

Zigbee2MQTT:error 2020-09-10 14:44:52: Request 'zigbee2mqtt/bridge/request/touchlink/scan' failed with error: 'SREQ '--> AF - interPanCtl - {"cmd":1,"data":[13]}' failed with status '(0xba: APS_NOT_ALLOWED)' (expected '(0x00: SUCCESS)')'

Then everything fails.

nurikk commented 4 years ago

My devices are missing icons or all white, and make the map harder to read. I wish I had ghost devices. :)

image

Icons are definitely there, but damn hard to see. Eventually we will update device icons

Screenshot 2020-09-11 at 06 36 58
nurikk commented 4 years ago

Also 2x clicking on the scan button crashes the coordinator with

Zigbee2MQTT:error 2020-09-10 14:44:52: Request 'zigbee2mqtt/bridge/request/touchlink/scan' failed with error: 'SREQ '--> AF - interPanCtl - {"cmd":1,"data":[13]}' failed with status '(0xba: APS_NOT_ALLOWED)' (expected '(0x00: SUCCESS)')'

Then everything fails.

Fixed, try npm install zigbee2mqtt-frontend@0.1.54

sjorge commented 4 years ago

Looks like the device state tab is now broken

scrshot

Koenkk commented 4 years ago

@sjorge @nurikk did some touchlink improvements, while a touchlink operation is in progress nothing else is allowed (also not a second touchlink operation).

sjorge commented 4 years ago

Seems more stable now, before the coordinator could crash, whoops doing a manual npm install seems to have broken my update script. I just need to reset packages.json and do npm cgi right to get back to whatever is in dev?

Edit: yep, seems so

nurikk commented 4 years ago

Looks like the device state tab is now broken

scrshot

Yeah, broken after very big refactoring 👎 Fixed already, kindly update your dependencies

sjorge commented 4 years ago

Noticed few missing features:

nurikk commented 4 years ago
  • readonly vs writable values seems like a lot of manual work, e.g. some sensors show temperature and humidity as writable, atleast for those sensors they aren't... can we auto detect this somehow?

Perhaps we can iterate over zigbee-herdsman-converters/devices.js find toZigbee records and extract writeable states from key attribute, this doable :)

  • it's not possible to pass the ID for a group your creating

Any practical reason to do this?

nurikk commented 4 years ago

Btw, currently I'm working on big refactoring. If someone feeling adventurous enough, kindly help me to test frontend using next version

npm install zigbee2mqtt-frontend@0.2.1