Giter Club home page Giter Club logo

iobroker-react's Introduction

Github-Banner

IoT enthusiast, perfectionist and a little bit crazy

I am working full time on Z-Wave JS, a Z-Wave driver written entirely in TypeScript. Started in 2018, Z-Wave JS has breathed new life into the Z-Wave ecosystem and now powers thousands of smart homes and some of the largest home automation systems all over the world.

In my free time, I'm a contributor to ioBroker, where I maintain adapters for Trådfri, BLE and Z-Wave and where I'm striving to make the developer experience better for everyone.

Besides that, I'm developing and maintaining several libraries to bring low-level IoT protocols into the Node.js world: DTLS, CoAP(s), and node-tradfri-client. If you are interfacing a Trådfri or Philips Hue bridge, you might be using one of them.

If you want to support what I do, you can

iobroker-react's People

Contributors

alcalzone avatar xxbjxx avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kyuka-dom xxbjxx

iobroker-react's Issues

Connection loss handling in `useIoBrokerState()` etc.

While moving around the house/town, maybe even when the site goes into the background, the websocket can get disconnected. The reconnect usually works fine, but any updates which happened in the "downtime" won't show up in the page. Subscriptions are restored automatically (probably here), so at least when the value changes again, it will show correctly. This affects at least useIoBrokerState(), but probably also useIoBrokerObject().

I looked into various ways to fix it:


In ioBroker/socket-client, there are various instructions to ensure that loadData() is only triggered for the first connect. Which probably makes sense because that client seems to be mostly stateless. Sure, system config could have changed between disconnect and reconnect, but apart from that there doesn't seem to be any "caching" of objects and values. So there is nothing that could become outdated.

In contrast to that, the hooks remember the last state/object data. Basically useIoBrokerState() would just need to call loadInitial() again after a reconnect. But for that, the Connection would need a way to subscribe to reconnects and the hooks would need to use it.

I also thought that the value from useConnection() would change when the connection disconnects (to null or undefined) or reconnects (to a new object). That would make it possible to track the connection lifecycle (e.g. display a "connected" icon) and would also trigger a re-run of all those effects which have connection in their dependencies. Looks like the most natural way to me, although various places would do unnecessary stuff then. For example, it would be pointless to unsubscribe and then resubscribe to state updates because the former necessarily happens at disconnect and the latter is done by the socket-client already, without any way to disable it. But I'm sure that there would be fairly easy ways to avoid such efforts.

Finally, it might be possible (maybe not here, but in socket-client) to request the latest state/object for all subscriptions after a reconnect. After all, someone cared to subscribe to them and they might have changed in between. The results of those requests would be handled via the usual means, just as if the value had really changed. But I guess wildcards would be a problem.


My favorite would be the one with useConnection(), but I'd like to hear your opinion.

Optionally pass style to useDialogs

Would it be possible to add an option to the useDialogs hook to optionally pass css to customize the dialog a little bit e.g. size, position etc.?

Array changes are not recognized by useSettings

When creating the native obj I noticed that when I change/add my config the save buttons are not unlocked.
My native obj consists of one obj and otherwise just array with obj that are changed or deleted/added here is an example:

"native": {
	"tablets": [
	  {
		"id": 0,
		"config": {
		  "active": false,
		  "interval": 30,
		  "name": "Test1",
		  "Login": {
			"ip": "",
			"port": 2323,
			"password": ""
		  },
		  "charger": {
			"active": false,
			"chargerId": "",
			"powerMode": "false",
			"loadStart": 20,
			"loadStop": 85
		  }
		}
	  },
            {
		"id": 1,
		"config": {
		  "active": false,
		  "interval": 30,
		  "name": "Test2",
		  "Login": {
			"ip": "",
			"port": 2323,
			"password": ""
		  },
		  "charger": {
			"active": false,
			"chargerId": "",
			"powerMode": "false",
			"loadStart": 20,
			"loadStop": 85
		  }
		}
	  }
	]
  },

Password is not encrypted when I use "encryptedNative"

I noticed that the password is not encrypted when I use "encryptedNative": ["password"] it is written unencrypted in "native": {"password": "12345",} and then encrypted in the adapter code

Screenshot 2022-10-26 012539
Screenshot 2022-10-26 012615

I have put all this in the template_adapter, you can have a look at it there.
branch: 123-convert-to-iobroker--adapter-dev
Link

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.