ChristianKoenig Posted August 17 Share Posted August 17 Hello everyone, I have a Varta PV battery storage which is able to switch Shelly Gen1 device on/off when certain data points are meet (e.g. amount of stored energy, extra available power etc...). The problem is now that I have a Shelly Pro 2 which is a Gen2 device to switch a water pump and heat generator on/off. When I specify the IP address of the Shelly Pro 2 in the Varta Web interface as relay I see requests like "shelly_http_server.:268 No handler for '/settings'" in the log of the Pro2. Question is if it's somehow possible to let a script reacts on the URL "/settings" on the Pro2 Web server or any other possible way to get my Gen2 device to behave like a Gen1? It's basically just getting the switch on/off signaling over http here and that is probably not to hard to handle. Otherwise I would have to replace my Pro2 with multiple Gen1 devices. Thanks in advance for any help, Christian. Quote Link to comment Share on other sites More sharing options...
Members thgoebel Posted August 17 Members Share Posted August 17 What does VARTA say? It would be much better to upgrade the VARTA firmware… 1 Quote Link to comment Share on other sites More sharing options...
tvbshelly Posted August 17 Share Posted August 17 (edited) @ChristianKoenig Unfortunately, the Gen1 API is quite different from the Gen2+ API Since the future devices will certainly all be Gen2/3, it would of course be better if Varta update the firmware and also support the new API - as @thgoebel has already said. Gen1: https://shelly-api-docs.shelly.cloud/gen1/ Gen2+: https://shelly-api-docs.shelly.cloud/gen2/ I guess it will be difficult to translate directly on the device via scripting. It may be possible to achieve a translation using external software, e.g. an API gateway. But first you would have to know exactly what calls are taking place (although it would also be possible to record them on the network). However, this all sounds like a very extensive undertaking to me. Edited August 17 by tvbshelly Quote Link to comment Share on other sites More sharing options...
Members thgoebel Posted August 17 Members Share Posted August 17 A simple Shelly 2.5 could otherwise serve as „interface“ between VARTA and Shelly pro 2. Exactly two channels with on/off states are available in both devices. The Shelly 2.5 could either interact directly („hard wired“) with the SW inputs of the pro 2 or via webhooks/actions. Quote Link to comment Share on other sites More sharing options...
ChristianKoenig Posted August 21 Author Share Posted August 21 Varta hasn't reacted on my support request at all 😞 Using a Shelly 2.5 device is a really good suggestion, unfortunately it's not available any more https://www.shelly.com/en-bg/products/shop/shelly-2-5-ce-ul-1 I could get some from eBay or similar, but would rather try to avoid that for a production installation. I wasn't able to emulate the Gen1 interface for the Varta because I couldn't find an example settings file the Varta would accep. But the Varta device also supports the Rutenbeck devices and those turned out to be rather easy to emulate 😉 Attached is a very small Python script which makes the Varta work with my Shelly Pro 2 😄 I would like to get rid of that and use the Shelly Pro 2 directly, but at least for now I have a working solution. If anybody has an example settings file from a Shelly 2.5 device I might be able to simplify that even more. Thanks in advance, Christian. test.py 1 Quote Link to comment Share on other sites More sharing options...
Members thgoebel Posted August 21 Members Share Posted August 21 Good job! Some „refurbished“ Shelly 2.5 are in my stock. They are equipped with brand new capacitors, e.g. 100μF with polymer dielectric medium. But it’s your decision… Quote Link to comment Share on other sites More sharing options...
ChristianKoenig Posted August 22 Author Share Posted August 22 Na, the combo of rasberry+shelly pro 2 now works rather reliable. But if you could provide an example settings file from the 2.5 I would be rather interested. Just to continue hacking the Varta to figure out what it actually supports and not. Quote Link to comment Share on other sites More sharing options...
Members thgoebel Posted August 22 Members Share Posted August 22 Don‘t own a VARTA system. Hence, I cannot provide a sample. Or what do you mean with „example settings file“? Quote Link to comment Share on other sites More sharing options...
ChristianKoenig Posted August 22 Author Share Posted August 22 The JSON file you get when you query /setting from the Shelly 2.5. Quote Link to comment Share on other sites More sharing options...
Members thgoebel Posted August 22 Members Share Posted August 22 You‘re welcome: {"device":{"type":"SHSW-25","mac":"34945477C169","hostname":"shellyswitch25-34945477C169","num_outputs":2, "num_meters":2, "num_rollers":1, "mode":"relay"},"wifi_ap":{"enabled":true,"ssid":"shellyswitch25-34945477C169","key":""},"wifi_sta":{"enabled":false,"ssid":null,"ipv4_method":"dhcp","ip":null,"gw":null,"mask":null,"dns":null},"wifi_sta1":{"enabled":false,"ssid":null,"ipv4_method":"dhcp","ip":null,"gw":null,"mask":null,"dns":null},"ap_roaming":{"enabled":false,"threshold":-70},"mqtt": {"enable":false,"server":"192.168.33.3:1883","user":"","id":"shellyswitch25-34945477C169","reconnect_timeout_max":60.000000,"reconnect_timeout_min":2.000000,"clean_session":true,"keep_alive":60,"max_qos":0,"retain":false,"update_period":30},"coiot": {"enabled":true,"update_period":15,"peer":""},"sntp":{"server":"time.google.com","enabled":true},"login":{"enabled":false,"unprotected":false,"username":"admin"},"pin_code":"","name":null,"fw":"20230913-112234/v1.14.0-gcb84623","factory_reset_from_switch":true,"pon_wifi_reset":false,"discoverable":true,"build_info":{"build_id":"20230913-112234/v1.14.0-gcb84623","build_timestamp":"2023-09-13T11:22:34Z","build_version":"1.0"},"cloud":{"enabled":false,"connected":false},"timezone":null,"lat":500.000000,"lng":500.000000,"tzautodetect":true,"tz_utc_offset":0,"tz_dst":false,"tz_dst_auto":true,"time":"","unixtime":0,"led_status_disable":false,"debug_enable":false,"allow_cross_origin":false,"actions":{"active":false,"names":["btn_on_url","btn_off_url","longpush_url","shortpush_url","out_on_url","out_off_url","btn_on_url","btn_off_url","longpush_url","shortpush_url","out_on_url","out_off_url","roller_open_url","roller_close_url","roller_stop_url"]},"hwinfo":{"hw_revision":"prod-191217", "batch_id":1},"mode":"relay","max_power":1840,"longpush_time":800,"relays":[{"name":null,"appliance_type":"General","ison":false,"has_timer":false,"default_state":"switch","btn_type":"toggle","btn_reverse":0,"auto_on":0.00,"auto_off":0.00,"max_power":0,"schedule":false,"schedule_rules":[]},{"name":null,"appliance_type":"General","ison":false,"has_timer":false,"default_state":"switch","btn_type":"toggle","btn_reverse":0,"auto_on":0.00,"auto_off":0.00,"max_power":0,"schedule":false,"schedule_rules":[]}],"rollers":[{"maxtime":20.00,"maxtime_open":20.00,"maxtime_close":20.00,"default_state":"stop","swap":false,"swap_inputs":false,"input_mode":"openclose","button_type":"toggle","btn_reverse":0,"state":"stop","power":0.00,"is_valid":true,"safety_switch":false,"schedule":false,"schedule_rules":[],"obstacle_mode":"disabled","obstacle_action":"stop","obstacle_power":200,"obstacle_delay":1,"ends_delay":2500,"safety_mode":"while_opening","safety_action":"stop","safety_allowed_on_trigger":"none","off_power":2,"positioning":true}],"favorites_enabled":false,"favorites":[{"name":"Position 1","pos":0},{"name":"Position 2","pos":0},{"name":"Position 3","pos":0},{"name":"Position 4","pos":0}],"eco_mode_enabled":true} This is http://192.168.33.1/settings after a factory reset of a Shelly 2.5. Quote Link to comment Share on other sites More sharing options...
ChristianKoenig Posted August 24 Author Share Posted August 24 Thanks again for the help. With the setting file I was able to change the hack so that only a minimal python script is needed. After a lot of try and error I cam up with the attached two scripts. The Shelly script provides the settings and status files the Varta needs to let the Pro 2 look like a Shell 2.5 to it (the device type name is actually all the Varta wants to see). And the Python script just remaps the URLs for accesses to /settings and /status. The only remaining reason I need the Python script is that HTTPServer.registerEndpoint() can't register a script handler for /settings and /status, but rather only for /script/<script_id>/settings and /script/<script_id>/status. But I fear that I won't be able to implement that without coming up with a custom firmware file to the Shelly Pro 2. Or does anybody has some other idea? varta_hack.js varta_hack.py Quote Link to comment Share on other sites More sharing options...
tvbshelly Posted August 24 Share Posted August 24 This is a really good solution. I don't think it will be possible any smaller. I would have liked to register other HHTP endpoints, too, but it only works with the /script/<id> in the path. This is understandable in itself, because it makes it easier for the firmware. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.